diff --git a/.azure-pipelines/client.test.live.yml b/.azure-pipelines/client.test.live.yml index b88d568f1a1d..4367d626bb0e 100644 --- a/.azure-pipelines/client.test.live.yml +++ b/.azure-pipelines/client.test.live.yml @@ -4,22 +4,49 @@ variables: value: $(java-keyvault-test-arm-client-id) - name: ARM_CLIENTKEY value: $(java-keyvault-test-arm-client-key) + - name: AZURE_BATCH_ACCOUNT + value: $(java-batch-test-account-name) + - name: AZURE_BATCH_ACCESS_KEY + value: $(java-batch-test-account-access-key) + - name: STORAGE_ACCOUNT_NAME + value: $(java-batch-test-storage-account-name) + - name: STORAGE_ACCOUNT_KEY + value: $(java-batch-test-storage-account-key) + + +jobs: + +- job: 'LiveTest' + + strategy: + matrix: + AzureBatch: + pomFilePath: './batch/data-plane/pom.xml' + AzureKeyVault: + pomFilePath: './keyvault/data-plane/pom.xml' + + pool: + vmImage: 'vs2017-win2016' -queue: - name: Hosted VS2017 -steps: # Adding -Dmaven.wagon.http.pool=false to the mvn command as a workaround to prevent build failures at maven artifacts downloading stage. -- bash: | - LOG_PARAMS='-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' - mvn test -Dmaven.wagon.http.pool=false -Dsurefire.rerunFailingTestsCount=3 $LOG_PARAMS -f $(pomFile) - displayName: 'Run Live Tests' - env: - ARM_CLIENTID: $(ARM_CLIENTID) - ARM_CLIENTKEY: $(ARM_CLIENTKEY) - AZURE_TEST_MODE: RECORD - -- task: PublishTestResults@2 - inputs: - testResultsFormat: 'JUnit' - testResultsFiles: '**/TEST-*.xml' + steps: + - bash: | + LOG_PARAMS='-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' + mvn test -Dmaven.wagon.http.pool=false -Dsurefire.rerunFailingTestsCount=3 $LOG_PARAMS -f $(pomFilePath) + displayName: 'Run Live Tests' + env: + ARM_CLIENTID: $(ARM_CLIENTID) + ARM_CLIENTKEY: $(ARM_CLIENTKEY) + AZURE_TEST_MODE: RECORD + AZURE_BATCH_ACCOUNT: $(AZURE_BATCH_ACCOUNT) + AZURE_BATCH_ACCESS_KEY: $(AZURE_BATCH_ACCESS_KEY) + STORAGE_ACCOUNT_KEY: $(STORAGE_ACCOUNT_KEY) + STORAGE_ACCOUNT_NAME: $(STORAGE_ACCOUNT_NAME) + AZURE_BATCH_ENDPOINT: https://servbatch.centralus.batch.azure.com + + - task: PublishTestResults@2 + inputs: + testResultsFormat: 'JUnit' + testResultsFiles: '**/TEST-*.xml' + diff --git a/batch/data-plane/.gitignore b/batch/data-plane/.gitignore new file mode 100644 index 000000000000..4d3976c3b7bc --- /dev/null +++ b/batch/data-plane/.gitignore @@ -0,0 +1,53 @@ +*.class + +# Auth files +*.auth +*.azureauth + +# Local checkstyle +*.checkstyle + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# Azure Tooling # +node_modules +packages + +# Eclipse # +*.pydevproject +.project +.metadata +bin/** +tmp/** +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# Other Tooling # +.classpath +.project +target +.idea +*.iml + +# Mac OS # +.DS_Store +.DS_Store? + +# Windows # +Thumbs.db + +# reduced pom files should not be included +dependency-reduced-pom.xml \ No newline at end of file diff --git a/batch/data-plane/.travis.yml b/batch/data-plane/.travis.yml new file mode 100644 index 000000000000..1fa7925fba17 --- /dev/null +++ b/batch/data-plane/.travis.yml @@ -0,0 +1,8 @@ +language: java +sudo: false +jdk: +- oraclejdk8 +- openjdk7 +script: +- mvn install -DskipTests=true +- mvn package javadoc:aggregate -DskipTests=true diff --git a/batch/data-plane/LICENSE.txt b/batch/data-plane/LICENSE.txt new file mode 100644 index 000000000000..49d21669aeef --- /dev/null +++ b/batch/data-plane/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/batch/data-plane/README.md b/batch/data-plane/README.md new file mode 100644 index 000000000000..779b19f95525 --- /dev/null +++ b/batch/data-plane/README.md @@ -0,0 +1,141 @@ +[![Build Status](https://travis-ci.org/Azure/azure-batch-sdk-for-java.svg?style=flat-square&label=build)](https://travis-ci.org/Azure/azure-batch-sdk-for-java) + +## Azure Batch Libraries for Java + +This README is based on the latest released version Azure Batch SDK (5.0.1). If you are looking for other releases, see the [More Information](#more-information) section below. + +The Azure Batch Libraries for Java is a higher-level, object-oriented API for interacting with the Azure Batch service. + + +> **5.0.1** is a release that supports all features of Azure Batch service with API version "2018-12-01.8.1". We will be adding support for more new features and tweaking the API associated with Azure Batch service newer release. + +**Azure Batch Authentication** + +You need to create a Batch account through the [Azure portal](https://portal.azure.com) or Azure cli. + +* Use the account name, key, and URL to create a `BatchSharedKeyCredentials` instance for authentication with the Azure Batch service. +The `BatchClient` class is the simplest entry point for creating and interacting with Azure Batch objects. + +```java +BatchSharedKeyCredentials cred = new BatchSharedKeyCredentials(batchUri, batchAccount, batchKey); +BatchClient client = BatchClient.open(cred); +``` + +* The other way is using AAD (Azure Active Directory) authentication to create the client. See this [document](https://docs.microsoft.com/en-us/azure/batch/batch-aad-auth) for detail. + +```java +BatchApplicationTokenCredentials cred = new BatchApplicationTokenCredentials(batchEndpoint, clientId, applicationSecret, applicationDomain, null, null); +BatchClient client = BatchClient.open(cred); +``` + +**Create a pool using an Azure Marketplace image** + +You can create a pool of Azure virtual machines which can be used to execute tasks. + +```java +System.out.println("Created a pool using an Azure Marketplace image."); + +VirtualMachineConfiguration configuration = new VirtualMachineConfiguration(); +configuration.withNodeAgentSKUId(skuId).withImageReference(imageRef); +client.poolOperations().createPool(poolId, poolVMSize, configuration, poolVMCount); + +System.out.println("Created a Pool: " + poolId); +``` + +**Create a Job** + +You can create a job by using the recently created pool. + +```java +PoolInformation poolInfo = new PoolInformation(); +poolInfo.withPoolId(poolId); +client.jobOperations().createJob(jobId, poolInfo); +``` + +# Sample Code + +You can find sample code that illustrates Batch usage scenarios in https://github.com/azure/azure-batch-samples + + +# Download + + +**5.0.1** + +If you are using released builds from 5.0.1, add the following to your POM file: + +```xml + + com.microsoft.azure + azure-batch + 5.0.1 + + + com.microsoft.azure + azure-client-runtime + 1.6.4 + +``` + +# Pre-requisites + +- A Java Developer Kit (JDK), v 1.7 or later +- Maven +- Azure Service Principal - see [how to create authentication info](./AUTH.md). + + +## Help + +If you encounter any bugs with these libraries, please file issues via [Issues](https://github.com/Azure/azure-batch-sdk-for-java/issues) or checkout [StackOverflow for Azure Java SDK](http://stackoverflow.com/questions/tagged/azure-java-sdk). + +# Contribute Code + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request + +# Build Code +To build the code open a console, navigate to the git repository, and run +``` +maven build +``` + +# Test Code +To run tests, set the following environment variables: +* AZURE_BATCH_ENDPOINT +* CLIENT_ID +* APPLICATION_SECRET +* AZURE_BATCH_ACCOUNT +* AZURE_BATCH_ACCESS_KEY +* STORAGE_ACCOUNT_NAME +* STORAGE_ACCOUNT_KEY +Then run any test in src/test/java directory. + +# More Information +* [Javadoc](http://azure.github.io/azure-sdk-for-java) +* [http://azure.com/java](http://azure.com/java) +* If you don't have a Microsoft Azure subscription you can get a FREE trial account [here](http://go.microsoft.com/fwlink/?LinkId=330212) + +**Previous Releases and Corresponding Repo Branches** + +| Version | SHA1 | Remarks | +|-------------------|-------------------------------------------------------------------------------------------|-------------------------------------------------------| +| 5.0.1 | [5.0.1](https://github.com/Azure/azure-batch-sdk-for-java/tree/master) | Tagged release for 5.0.1 version of Azure Batch libraries | +| 5.0.0 | [5.0.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v5.0.0) | Tagged release for 5.0.0 version of Azure Batch libraries | +| 4.0.1 | [4.0.1](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v4.0.1) | Tagged release for 4.0.1 version of Azure Batch libraries | +| 4.0.0 | [4.0.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v4.0.0) | Tagged release for 4.0.0 version of Azure Batch libraries | +| 3.2.0 | [3.2.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v3.2.0) | Tagged release for 3.2.0 version of Azure Batch libraries | +| 3.1.0 | [3.1.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v3.1.0) | Tagged release for 3.1.0 version of Azure Batch libraries | +| 3.0.0 | [3.0.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v3.0.0) | Tagged release for 3.0.0 version of Azure Batch libraries | +| 2.1.0 | [2.1.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v2.1.0) | Tagged release for 2.1.0 version of Azure Batch libraries | +| 2.0.0 | [2.0.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v2.0.0) | Tagged release for 2.0.0 version of Azure Batch libraries | +| 1.0.0 | [1.0.0](https://github.com/Azure/azure-batch-sdk-for-java/releases/tag/v1.0.0) | Tagged release for 1.0.0 version of Azure Batch libraries | +| 1.0.0-beta2 | [1.0.0-beta2](https://github.com/Azure/azure-sdk-for-java/tree/1.0.0-beta2) | Tagged release for 1.0.0-beta2 version of Azure Batch libraries | + +--- + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. \ No newline at end of file diff --git a/batch/data-plane/changelog.md b/batch/data-plane/changelog.md new file mode 100644 index 000000000000..1f87e17888f3 --- /dev/null +++ b/batch/data-plane/changelog.md @@ -0,0 +1,80 @@ +# Azure Batch SDK for Java release notes + +## Changes in 5.0.1 +### Features +### Fixes + - Fix corrupt signing of 5.0.0 Java SDK binary + +## Changes in 5.0.0 +### Features +- **[Breaking]** Removed support for the `ChangeOSVersion` API on `CloudServiceConfiguration` pools. + - Removed `PoolOperations.ChangeOSVersion`. + - Renamed `TargetOSVersion` to `OSVersion` and removed `CurrentOSVersion` on `CloudPool`. + - Removed `PoolState.Upgrading` enum. +- **[Breaking]** Removed `DataEgressGiB` and `DataIngressGiB` from `PoolUsageMetrics`. These properties are no longer supported. +- **[Breaking]** ResourceFile improvements + - Added the ability specify an entire Azure Storage container in `ResourceFile`. There are now three supported modes for `ResourceFile`: + - `ResourceFile.withUrl` creates a `ResourceFile` pointing to a single HTTP URL. + - `ResourceFile.withStorageContainerUrl` creates a `ResourceFile` pointing to an Azure Blob Storage container. + - `ResourceFile.withAutoStorageContainer` creates a `ResourceFile` pointing to an Azure Blob Storage container in the Batch registered auto-storage account. + - The `BlobPrefix` property can be used to filter downloads from a storage container to only those matching the prefix. + - URLs provided to `ResourceFile` via the `ResourceFile.withUrl` method can now be any HTTP URL. Previously, these had to be an Azure Blob Storage URL. +- **[Breaking]** Removed `OSDisk` property from `VirtualMachineConfiguration`. This property is no longer supported. +- Pools which set the `DynamicVNetAssignmentScope` on `NetworkConfiguration` to be `DynamicVNetAssignmentScope.Job` can + now dynamically assign a Virtual Network to each node the job's tasks run on. The specific Virtual Network to join the nodes to is specified in + the new `JobNetworkConfiguration` property on `CloudJob` and `JobSpecification`. + - Note: This feature is in public preview. It is disabled for all Batch accounts except for those which have contacted us and requested to be in the pilot. +- The maximum lifetime of a task is now 180 days (previously it was 7). +- Added support on Windows pools for creating users with a specific login mode (either `Batch` or `Interactive`) via `WindowsUserConfiguration.LoginMode`. +- The default task retention time for all tasks is now 7 days, previously it was infinite. + +### REST API version +This version of the Batch .NET client library targets version 2018-12-01.8.0 of the Azure Batch REST API. + +## Changes in 4.0.1 +### Fixes + - Fix missing signing of 4.0.0 Java SDK binary + +## Changes in 4.0.0 +### Features + - Added the functionality to get which version of the Azure Batch Node Agent(https://github.com/Azure/Batch/blob/master/changelogs/nodeagent/CHANGELOG.md) is running on nodes via the NodeAgentInformation property of ComputeNode. + - Added additional error handling to task add operations to prevent deadlock scenarios. + - Removed validation status from count operations. + - Updated adal, azure-client-runtime, and commons-codec dependencies. + - Update 'List' methods to return the lower layer PagedList object instead of the standard List. + +### REST API version +This version of the Batch Java client library targets version 2018-08-01.7.1 of the Azure Batch REST API. See this [document](https://docs.microsoft.com/en-us/rest/api/batchservice/batch-service-rest-api-versioning#latest-version-2018-08-0171) for detail. + +## Changes in 3.3.0 +### Features + - `createTasks` rethrow `RuntimeException` catched by internal threads. + - `createTasks` handle `RequestSizeTooLarge` chunking errors for well behaved tasks. + +## Changes in 3.2.0 +### Features + - Update comments for some classes and properties. + - Added the `leavingPool` property to `NodeCounts` class. + +## Changes in 3.1.0 +### Features + - Added the ability to query pool node counts by state, via the new `listPoolNodeCounts` method on `PoolOperations`. + - Added the ability to upload Azure Batch node agent logs from a particular node, via the `uploadComputeNodeBatchServiceLogs` method on `ComputeNodeOperations`. + - This is intended for use in debugging by Microsoft support when there are problems on a node. + +### REST API version +This version of the Batch Java client library targets version 2018-03-01.6.1 of the Azure Batch REST API. See this [document](https://docs.microsoft.com/en-us/rest/api/batchservice/batch-service-rest-api-versioning#latest-version-2018-03-0161) for detail. + + +## Changes in 3.0.0 +### Features +- Added the ability to get a discount on Windows VM pricing if you have on-premises licenses for the OS SKUs you are deploying, via `licenseType` on `VirtualMachineConfiguration`. +- Added support for attaching empty data drives to `VirtualMachineConfiguration` based pools, via the new `dataDisks` property on `VirtualMachineConfiguration`. +- **[Breaking]** Custom images must now be deployed using a reference to an ARM Image, instead of pointing to .vhd files in blobs directly. + - The new `virtualMachineImageId` property on `ImageReference` contains the reference to the ARM Image, and `OSDisk.imageUris` no longer exists. + - Because of this, `imageReference` is now a required property of `VirtualMachineConfiguration`. +- **[Breaking]** Multi-instance tasks (created using `MultiInstanceSettings`) must now specify a `coordinationCommandLine`, and `numberOfInstances` is now optional and defaults to 1. +- Added support for tasks run using Docker containers. To run a task using a Docker container you must specify a `containerConfiguration` on the `VirtualMachineConfiguration` for a pool, and then add `taskContainerSettings` on the Task. + +### REST API version +This version of the Batch Java client library targets version 2017-09-01.6.0 of the Azure Batch REST API. See this [document](https://docs.microsoft.com/en-us/rest/api/batchservice/batch-service-rest-api-versioning#latest-version-2017-09-0160) for detail. \ No newline at end of file diff --git a/batch/data-plane/gulpfile.js b/batch/data-plane/gulpfile.js new file mode 100644 index 000000000000..228cb266176d --- /dev/null +++ b/batch/data-plane/gulpfile.js @@ -0,0 +1,100 @@ +var gulp = require('gulp'); +var args = require('yargs').argv; +var colors = require('colors'); +var exec = require('child_process').exec; +var fs = require('fs'); + +var mappings = { + 'batchService': { + 'source': 'specification/batch/data-plane/Microsoft.Batch/stable/2018-08-01.7.1/BatchService.json', + 'package': 'com.microsoft.azure.batch.protocol', + 'fluent': false, + 'args': '-FT 1' + } +}; + +gulp.task('default', function() { + console.log("Usage: gulp codegen [--spec-root ] [--autorest ] [--modeler ] [--autorest-args ]\n"); + console.log("--spec-root"); + console.log("\tRoot location of Swagger API specs, default value is \"https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master\""); + console.log("--autorest\n\tThe version of AutoRest. E.g. 0.15.0, or the location of AutoRest repo, E.g. E:\\repo\\autorest"); + console.log("--modeler\n\tSpecifies which modeler to use. Default is 'Swagger'"); + console.log("--autorest-args\n\tPasses additional argument to AutoRest generator"); +}); + +var specRoot = args['spec-root'] || "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/current"; +var projects = 'batchService'; // default +var autoRestVersion = '1.2.2'; // default +if (args['autorest'] !== undefined) { + autoRestVersion = args['autorest']; +} +var modeler = 'Swagger'; // default +if (args['modeler'] !== undefined) { + modeler = args['modeler']; +} +var autoRestArgs = args['autorest-args']; +var autoRestExe; + +gulp.task('codegen', function(cb) { + autoRestExe = 'autorest'; + handleInput(projects, cb); +}); + +var handleInput = function(projects, cb) { + if (projects === undefined) { + Object.keys(mappings).forEach(function(proj) { + codegen(proj, cb); + }); + } else { + projects.split(",").forEach(function(proj) { + proj = proj.replace(/\ /g, ''); + if (mappings[proj] === undefined) { + console.error('Invalid project name "' + proj + '"!'); + process.exit(1); + } + codegen(proj, cb); + }); + } +} + +var codegen = function(project, cb) { + var outputDir = 'src/main/java/' + mappings[project].package.replace(/\./g, '/'); + deleteFolderRecursive(outputDir); + console.log('Generating "' + project + '" from spec file ' + specRoot + '/' + mappings[project].source); + var generator = '--fluent '; + if (mappings[project].fluent !== null && mappings[project].fluent === false) { + generator = ''; + } + cmd = autoRestExe + ' --java ' + + ' --azure-arm ' + + ' --namespace=' + mappings[project].package + + ' --input-file=' + specRoot + '/' + mappings[project].source + + ' --java.output-folder=' + 'src/main/java/' + mappings[project].package.replace(/\./g, '/') + + ' --license-header=MICROSOFT_MIT_NO_CODEGEN' + + ' -' + autoRestArgs; + if (mappings[project].args !== undefined) { + cmd = cmd + ' ' + mappings[project].args; + } + console.log('Command: ' + cmd); + exec(cmd, function(err, stdout, stderr) { + console.log(stdout); + console.error(stderr); + }); +}; + +var deleteFolderRecursive = function(path) { + var header = "Code generated by Microsoft (R) AutoRest Code Generator"; + if(fs.existsSync(path)) { + fs.readdirSync(path).forEach(function(file, index) { + var curPath = path + "/" + file; + if(fs.lstatSync(curPath).isDirectory()) { // recurse + deleteFolderRecursive(curPath); + } else { // delete file + var content = fs.readFileSync(curPath).toString('utf8'); + if (content.indexOf(header) > -1) { + fs.unlinkSync(curPath); + } + } + }); + } +}; \ No newline at end of file diff --git a/batch/data-plane/package.json b/batch/data-plane/package.json new file mode 100644 index 000000000000..a84a7f674c96 --- /dev/null +++ b/batch/data-plane/package.json @@ -0,0 +1,24 @@ +{ + "name": "azure-sdk-for-java-codegen", + "version": "0.0.1", + "description": "Tools for Azure SDK for Java build processes", + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-java.git" + }, + "keywords": [ + "azure" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-java/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-java#readme", + "devDependencies": { + "colors": "1.1.2", + "gulp": "^3.9.0", + "gulp-exec": "2.1.2", + "yargs": "3.29.0" + } +} \ No newline at end of file diff --git a/batch/data-plane/pom.xml b/batch/data-plane/pom.xml new file mode 100644 index 000000000000..ff8ed74698ea --- /dev/null +++ b/batch/data-plane/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.0.0-SNAPSHOT + ../../pom.client.xml + + + com.microsoft.azure + azure-batch + jar + 5.0.1 + + Microsoft Azure Batch SDK Root + This package contains the root module of Microsoft Azure Batch 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 + v5.0.1 + + + + + microsoft + Microsoft Corporation + + + + + + com.microsoft.azure + azure-client-runtime + + + + com.microsoft.azure + adal4j + + + + commons-codec + commons-codec + + + + + junit + junit + test + + + + com.microsoft.azure + azure-storage + test + + + + commons-io + commons-io + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.7 + 1.7 + true + true + + + + + + + + diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/AccountOperations.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/AccountOperations.java new file mode 100644 index 000000000000..1edada594c4c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/AccountOperations.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusOptions; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.NodeAgentSku; +import com.microsoft.azure.batch.protocol.models.PoolNodeCounts; +import com.microsoft.azure.batch.protocol.models.AccountListPoolNodeCountsOptions; + +import java.io.IOException; +import java.util.Collection; + +/** + * Performs account-related operations on an Azure Batch account. + */ +public class AccountOperations implements IInheritedBehaviors { + + AccountOperations(BatchClient batchClient, Collection customBehaviors) { + parentBatchClient = batchClient; + + // inherit from instantiating parent + InternalHelper.InheritClientBehaviorsAndSetPublicProperty(this, customBehaviors); + } + + private Collection customBehaviors; + + private final BatchClient parentBatchClient; + + /** + * Gets a collection of behaviors that modify or customize requests to the Batch service. + * + * @return A collection of {@link BatchClientBehavior} instances. + */ + @Override + public Collection customBehaviors() { + return customBehaviors; + } + + /** + * Sets a collection of behaviors that modify or customize requests to the Batch service. + * + * @param behaviors The collection of {@link BatchClientBehavior} instances. + * @return The current instance. + */ + @Override + public IInheritedBehaviors withCustomBehaviors(Collection behaviors) { + customBehaviors = behaviors; + return this; + } + + /** + * Lists the node agent SKU values supported by the Batch service. + * + * @return A list of {@link NodeAgentSku} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listNodeAgentSkus() throws BatchErrorException, IOException { + return listNodeAgentSkus(null, null); + } + + /** + * Lists the node agent SKU values supported by the Batch service. + * + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @return A list of {@link NodeAgentSku} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listNodeAgentSkus(DetailLevel detailLevel) throws BatchErrorException, IOException { + return listNodeAgentSkus(detailLevel, null); + } + + /** + * Lists the node agent SKU values supported by the Batch service. + * + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A list of {@link NodeAgentSku} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listNodeAgentSkus(DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + AccountListNodeAgentSkusOptions options = new AccountListNodeAgentSkusOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this.parentBatchClient.protocolLayer().accounts().listNodeAgentSkus(options); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @return A list of {@link NodeAgentSku} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listPoolNodeCounts() throws BatchErrorException, IOException { + return listPoolNodeCounts(null, null); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A list of {@link PoolNodeCounts} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listPoolNodeCounts(DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + AccountListPoolNodeCountsOptions options = new AccountListPoolNodeCountsOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this.parentBatchClient.protocolLayer().accounts().listPoolNodeCounts(options); + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/ApplicationOperations.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/ApplicationOperations.java new file mode 100644 index 000000000000..b5b151398a49 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/ApplicationOperations.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.batch.protocol.models.ApplicationGetOptions; +import com.microsoft.azure.batch.protocol.models.ApplicationListOptions; +import com.microsoft.azure.batch.protocol.models.ApplicationSummary; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; + +import java.io.IOException; +import java.util.Collection; + +/** + * Performs application-related operations on an Azure Batch account. + */ +public class ApplicationOperations implements IInheritedBehaviors { + + ApplicationOperations(BatchClient batchClient, Collection customBehaviors) { + parentBatchClient = batchClient; + + // inherit from instantiating parent + InternalHelper.InheritClientBehaviorsAndSetPublicProperty(this, customBehaviors); + } + + private Collection customBehaviors; + + private final BatchClient parentBatchClient; + + /** + * Gets a collection of behaviors that modify or customize requests to the Batch service. + * + * @return A collection of {@link BatchClientBehavior} instances. + */ + @Override + public Collection customBehaviors() { + return customBehaviors; + } + + /** + * Sets a collection of behaviors that modify or customize requests to the Batch service. + * + * @param behaviors The collection of {@link BatchClientBehavior} instances. + * @return The current instance. + */ + @Override + public IInheritedBehaviors withCustomBehaviors(Collection behaviors) { + customBehaviors = behaviors; + return this; + } + + /** + * Lists the {@link ApplicationSummary applications} in the Batch account. + * + * @return A list of {@link ApplicationSummary} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listApplications() throws BatchErrorException, IOException { + return listApplications(null); + } + + /** + * Lists the {@link ApplicationSummary applications} in the Batch account. + * + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A list of {@link ApplicationSummary} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listApplications(Iterable additionalBehaviors) throws BatchErrorException, IOException { + ApplicationListOptions options = new ApplicationListOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + return this.parentBatchClient.protocolLayer().applications().list(options); + } + + /** + * Gets information about the specified application. + * + * @param applicationId The ID of the application to get. + * @return An {@link ApplicationSummary} containing information about the specified application. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public ApplicationSummary getApplication(String applicationId) throws BatchErrorException, IOException { + return getApplication(applicationId, null); + } + + /** + * Gets information about the specified application. + * + * @param applicationId The ID of the application to get. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return An {@link ApplicationSummary} containing information about the specified application. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public ApplicationSummary getApplication(String applicationId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ApplicationGetOptions options = new ApplicationGetOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + return this.parentBatchClient.protocolLayer().applications().get(applicationId, options); + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/BatchClient.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/BatchClient.java new file mode 100644 index 000000000000..f2f0979c3522 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/BatchClient.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.batch.auth.BatchCredentials; +import com.microsoft.azure.batch.interceptor.ClientRequestIdInterceptor; +import com.microsoft.azure.batch.protocol.BatchServiceClient; +import com.microsoft.azure.batch.protocol.implementation.BatchServiceClientImpl; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.RestException; +import com.microsoft.rest.protocol.ResponseBuilder; +import com.microsoft.rest.protocol.SerializerAdapter; + +import java.util.Collection; +import java.util.LinkedList; + +/** + * A client for an Azure Batch account, used to access the Batch service. + */ +public class BatchClient { + + private final BatchServiceClient protocolLayer; + private final CertificateOperations certificateOperations; + private final JobOperations jobOperations; + private final TaskOperations taskOperations; + private final JobScheduleOperations jobScheduleOperations; + private final PoolOperations poolOperations; + private final FileOperations fileOperations; + private final ComputeNodeOperations computeNodeOperations; + private final ApplicationOperations applicationOperations; + private final AccountOperations accountOperations; + private Collection customBehaviors; + + /** + * Gets the protocol layer service client that issues requests to the Azure Batch service. + * + * @return The protocol layer client. + */ + public BatchServiceClient protocolLayer() { + return this.protocolLayer; + } + + private BatchClient(BatchCredentials credentials) { + RestClient restClient = new RestClient.Builder() + .withBaseUrl(credentials.baseUrl()) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new ResponseBuilder.Factory() { + private final AzureResponseBuilder.Factory baseFactory = new AzureResponseBuilder.Factory(); + @Override + public ResponseBuilder newInstance(SerializerAdapter serializerAdapter) { + return baseFactory.newInstance(serializerAdapter).withThrowOnGet404(true); + } + }) + .build(); + this.protocolLayer = new BatchServiceClientImpl(restClient).withBatchUrl(credentials.baseUrl()); + this.customBehaviors = new LinkedList<>(); + this.customBehaviors.add(new ClientRequestIdInterceptor()); + this.certificateOperations = new CertificateOperations(this, customBehaviors()); + this.jobOperations = new JobOperations(this, customBehaviors()); + this.taskOperations = new TaskOperations(this, customBehaviors()); + this.jobScheduleOperations = new JobScheduleOperations(this, customBehaviors()); + this.poolOperations = new PoolOperations(this, customBehaviors()); + this.fileOperations = new FileOperations(this, customBehaviors()); + this.applicationOperations = new ApplicationOperations(this, customBehaviors()); + this.accountOperations = new AccountOperations(this, customBehaviors()); + this.computeNodeOperations = new ComputeNodeOperations(this, customBehaviors()); + } + + /** + * Creates an instance of {@link BatchClient} associated with the specified credentials. + * + * @param credentials A {@link BatchCredentials} object specifying the Batch account credentials. + * @return The new {@link BatchClient} instance. + */ + public static BatchClient open(BatchCredentials credentials) { + return new BatchClient(credentials); + } + + /** + * Gets a {@link CertificateOperations} object for performing certificate-related operations on the associated account. + * + * @return An instance of the {@link CertificateOperations} class. + */ + public CertificateOperations certificateOperations() { + return certificateOperations; + } + + /** + * Gets a {@link JobOperations} object for performing job-related operations on the associated account. + * + * @return An instance of the {@link JobOperations} class. + */ + public JobOperations jobOperations() { + return jobOperations; + } + + /** + * Gets a {@link TaskOperations} object for performing task-related operations on the associated account. + * + * @return An instance of the {@link TaskOperations} class. + */ + public TaskOperations taskOperations() { + return taskOperations; + } + + /** + * Gets a {@link JobScheduleOperations} object for performing job schedule-related operations on the associated account. + * + * @return An instance of the {@link JobScheduleOperations} class. + */ + public JobScheduleOperations jobScheduleOperations() { + return jobScheduleOperations; + } + + /** + * Gets a {@link FileOperations} object for performing file-related operations on the associated account. + * + * @return An instance of the {@link FileOperations} class. + */ + public FileOperations fileOperations() { + return fileOperations; + } + + /** + * Gets a {@link PoolOperations} object for performing pool-related operations on the associated account. + * + * @return An instance of the {@link PoolOperations} class. + */ + public PoolOperations poolOperations() { + return poolOperations; + } + + /** + * Gets a {@link ComputeNodeOperations} object for performing compute node-related operations on the associated account. + * + * @return An instance of the {@link ComputeNodeOperations} class. + */ + public ComputeNodeOperations computeNodeOperations() { + return computeNodeOperations; + } + + /** + * Gets an {@link ApplicationOperations} object for performing application-related operations on the associated account. + * + * @return An instance of the {@link ApplicationOperations} class. + */ + public ApplicationOperations applicationOperations() { + return applicationOperations; + } + + /** + * Gets an {@link AccountOperations} object for performing account-related operations on the associated account. + * + * @return An instance of the {@link AccountOperations} class. + */ + public AccountOperations accountOperations() { + return accountOperations; + } + + /** + * Gets a collection of behaviors that modify or customize requests to the Batch service. + * + * @return The collection of {@link BatchClientBehavior} instances. + */ + public Collection customBehaviors() { + return customBehaviors; + } + + /** + * Sets a collection of behaviors that modify or customize requests to the Batch service. + * + * @param customBehaviors The collection of {@link BatchClientBehavior} instances. + * @return The current instance. + */ + public BatchClient withCustomBehaviors(Collection customBehaviors) { + this.customBehaviors = customBehaviors; + return this; + } +} + diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/BatchClientBehavior.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/BatchClientBehavior.java new file mode 100644 index 000000000000..5408ef6e0877 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/BatchClientBehavior.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +/** + * Classes derived from the BatchClientBehavior class modify operational behaviors of an Azure Batch client. + */ +public abstract class BatchClientBehavior { +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/BatchErrorCodeStrings.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/BatchErrorCodeStrings.java new file mode 100644 index 000000000000..cadcae7c5475 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/BatchErrorCodeStrings.java @@ -0,0 +1,577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +/** + * Error code strings returned from the Batch service. + */ +public final class BatchErrorCodeStrings { + // Batch Service + + /** + * The specified account is disabled. + */ + public static final String AccountIsDisabled = "AccountIsDisabled"; + + /** + * The account has reached its quota of active jobs and job schedules. + */ + public static final String ActiveJobAndScheduleQuotaReached = "ActiveJobAndScheduleQuotaReached"; + + /** + * The specified application does not exist. + */ + public static final String ApplicationNotFound = "ApplicationNotFound"; + + /** + * An automatic scaling formula has a syntax error. + */ + public static final String AutoScalingFormulaSyntaxError = "AutoScalingFormulaSyntaxError"; + + /** + * An automatic scaling formula is too long. The maximum length is 8192 characters. + */ + public static final String AutoScaleFormulaTooLong = "AutoScaleFormulaTooLong"; + + /** + * Enable AutoScale requests for the same pool must be separated by at least 30 seconds. + */ + public static final String AutoScaleTooManyRequestsToEnable = "TooManyEnableAutoScaleRequests"; + + /** + * A certificate operation was attempted which is not permitted when the certificate is in the process of being deleted. + */ + public static final String CertificateBeingDeleted = "CertificateBeingDeleted"; + + /** + * The certificate you are attempting to add already exists. + */ + public static final String CertificateExists = "CertificateExists"; + + /** + * The certificate on which an operation was attempted is not present in the Batch account. + */ + public static final String CertificateNotFound = "CertificateNotFound"; + + /** + * A certificate operation was attempted which is not permitted when the certificate is active. + */ + public static final String CertificateStateActive = "CertificateStateActive"; + + /** + * A certificate could not be deleted because it is still in use. + */ + public static final String CertificateStateDeleteFailed = "CertificateDeleteFailed"; + + /** + * A node file requested from a task or compute node was not found. + */ + public static final String FileNotFound = "FileNotFound"; + + /** + * One or more application package references could not be satisfied. This occurs if the application + * ID or version does not exist or is not active, or if the reference did not specify a version and + * there is no default version configured. + */ + public static final String InvalidApplicationPackageReferences = "InvalidApplicationPackageReferences"; + + /** + * A pool specification specifies one or more invalid certificates (for example, certificates that are + * not present in the Batch account). + */ + public static final String InvalidCertificateReferences = "InvalidCertificateReferences"; + + /** + * A value in a job or task constraint is out of range. + */ + public static final String InvalidConstraintValue = "InvalidConstraintValue"; + + /** + * There is a conflict between the REST API being used and the account. + */ + public static final String InvalidRestAPIForAccountSetting = "InvalidRestAPIForAccountSetting"; + + /** + * A job operation was attempted which is not permitted when the job is in the process of being deleted. + */ + public static final String JobBeingDeleted = "JobBeingDeleted"; + + /** + * A job operation was attempted which is not permitted when the job is in the process of being terminated. + */ + public static final String JobBeingTerminated = "JobBeingTerminated"; + + /** + * A job operation was attempted which is not permitted when the job has been completed. + */ + public static final String JobCompleted = "JobCompleted"; + + /** + * A job operation was attempted which is not permitted when the job is not active. + */ + public static final String JobNotActive = "JobNotActive"; + + /** + * The specified job exists. + */ + public static final String JobExists = "JobExists"; + + /** + * A Job Preparation task was not run on a compute node. + */ + public static final String JobPreparationTaskNotRunOnNode = "JobPreparationTaskNotRunOnNode"; + + /** + * The specified job does not have a Job Preparation task. + */ + public static final String JobPreparationTaskNotSpecified = "JobPreparationTaskNotSpecified"; + + /** + * A Job Release task was not run on a compute node. + */ + public static final String JobReleaseTaskNotRunOnNode = "JobReleaseTaskNotRunOnNode"; + + /** + * The specified job does not have a Job Release task. + */ + public static final String JobReleaseTaskNotSpecified = "JobReleaseTaskNotSpecified"; + + /** + * The job on which an operation was attempted is not present in the Batch account. + */ + public static final String JobNotFound = "JobNotFound"; + + /** + * An I/O error occurred while trying to access a resource within the Batch account. + */ + public static final String IOError = "IOError"; + + /** + * The specified operation is not valid for the current state of the resource. + */ + public static final String OperationInvalidForCurrentState = "OperationInvalidForCurrentState"; + + /** + * The specified Azure Guest OS version is disabled. + */ + public static final String OSVersionDisabled = "OSVersionDisabled"; + + /** + * The specified Azure Guest OS version is expired. + */ + public static final String OSVersionExpired = "OSVersionExpired"; + + /** + * The specified Azure Guest OS version was not found. + */ + public static final String OSVersionNotFound = "OSVersionNotFound"; + + /** + * A job priority was specified which was outside the permitted range of -1000 to 1000. + */ + public static final String OutOfRangePriority = "OutOfRangePriority"; + + /** + * A file path was not found on a compute node. + */ + public static final String PathNotFound = "PathNotFound"; + + /** + * A pool operation was attempted which is not permitted when the pool is in the process of being deleted. + */ + public static final String PoolBeingDeleted = "PoolBeingDeleted"; + + /** + * A pool operation was attempted which is not permitted when the pool is in the process of being resized. + */ + public static final String PoolBeingResized = "PoolBeingResized"; + + /** + * A pool operation was attempted which is not permitted when the pool is in the process of being created. + */ + public static final String PoolBeingCreated = "PoolBeingCreated"; + + /** + * The pool you are attempting to add already exists. + */ + public static final String PoolExists = "PoolExists"; + + /** + * The specified pool is not eligible for an operating system version upgrade. + */ + public static final String PoolNotEligibleForOSVersionUpgrade = "PoolNotEligibleForOSVersionUpgrade"; + + /** + * The pool on which an operation was attempted is not present in the Batch account. + */ + public static final String PoolNotFound = "PoolNotFound"; + + /** + * The account has reached its quota of pools. + */ + public static final String PoolQuotaReached = "PoolQuotaReached"; + + /** + * The pool is already on the operating system version to which it was asked to upgrade. + */ + public static final String PoolVersionEqualsUpgradeVersion = "PoolVersionEqualsUpgradeVersion"; + + /** + * A requested storage account was not found. + */ + public static final String StorageAccountNotFound = "StorageAccountNotFound"; + + /** + * A task operation was attempted which is not permitted when the task has been completed. + */ + public static final String TaskCompleted = "TaskCompleted"; + + /** + * A task was specified as depending on other tasks, but the job did not specify that it would use task dependencies. + */ + public static final String TaskDependenciesNotSpecifiedOnJob = "TaskDependenciesNotSpecifiedOnJob"; + + /** + * A task was specified as depending on other tasks, but the list of dependencies was too long to be stored. + */ + public static final String TaskDependencyListTooLong = "TaskDependencyListTooLong"; + + /** + * A task was specified as depending on other tasks, but the list of task ID ranges was too long to be stored. + */ + public static final String TaskDependencyRangesTooLong = "TaskDependencyRangesTooLong"; + + /** + * The node files for a task are not available, for example because the retention period has expired. + */ + public static final String TaskFilesUnavailable = "TaskFilesUnavailable"; + + /** + * The files of the specified task are cleaned up. + */ + public static final String TaskFilesCleanedup = "TaskFilesCleanedup"; + + /** + * The task you are attempting to add already exists. + */ + public static final String TaskExists = "TaskExists"; + + /** + * The task ID is the same as that of the Job Preparation task. + */ + public static final String TaskIdSameAsJobPreparationTask = "TaskIdSameAsJobPreparationTask"; + + /** + * The task ID is the same as that of the Job Release task. + */ + public static final String TaskIdSameAsJobReleaseTask = "TaskIdSameAsJobReleaseTask"; + + /** + * The task on which an operation was attempted is not present in the job. + */ + public static final String TaskNotFound = "TaskNotFound"; + + /** + * A compute node operation was attempted which is not permitted when the node is in the process of being created. + */ + public static final String NodeBeingCreated = "NodeBeingCreated"; + + /** + * A compute node operation was attempted which is not permitted when the node is in the process of being started. + */ + public static final String NodeBeingStarted = "NodeBeingStarted"; + + /** + * A compute node operation was attempted which is not permitted when the node is in the process of being rebooted. + */ + public static final String NodeBeingRebooted = "NodeBeingRebooted"; + + /** + * A compute node operation was attempted which is not permitted when the node is in the process of being reimaged. + */ + public static final String NodeBeingReimaged = "NodeBeingReimaged"; + + /** + * The node counts do not match. + */ + public static final String NodeCountsMismatch = "NodeCountsMismatch"; + + /** + * The compute node on which an operation was attempted is not present in the given pool. + */ + public static final String NodeNotFound = "NodeNotFound"; + + /** + * A compute node operation was attempted which is not permitted when the node is unusable. + */ + public static final String NodeStateUnusable = "NodeStateUnusable"; + + /** + * The compute node user account you are attempting to add already exists. + */ + public static final String NodeUserExists = "NodeUserExists"; + + /** + * The compute node user account on which an operation was attempted does not exist. + */ + public static final String NodeUserNotFound = "NodeUserNotFound"; + + /** + * The specified compute node is already in the target scheduling state. + */ + public static final String NodeAlreadyInTargetSchedulingState = "NodeAlreadyInTargetSchedulingState"; + + /** + * The pool is already upgrading to a different operating system version. + */ + public static final String UpgradePoolVersionConflict = "UpgradePoolVersionConflict"; + + /** + * A requested job or task constraint is not supported. + */ + public static final String UnsupportedConstraint = "UnsupportedConstraint"; + + /** + * The specified version of the Batch REST API is not supported. + */ + public static final String UnsupportedRequestVersion = "UnsupportedRequestVersion"; + + /** + * A job schedule operation was attempted which is not permitted when the schedule is in the process of being deleted. + */ + public static final String JobScheduleBeingDeleted = "JobScheduleBeingDeleted"; + + /** + * A job schedule operation was attempted which is not permitted when the schedule is in the process of being terminated. + */ + public static final String JobScheduleBeingTerminated = "JobScheduleBeingTerminated"; + + /** + * A job schedule operation was attempted which is not permitted when the schedule has completed. + */ + public static final String JobScheduleCompleted = "JobScheduleCompleted"; + + /** + * A job schedule operation was attempted which is not permitted when the schedule is disabled. + */ + public static final String JobScheduleDisabled = "JobScheduleDisabled"; + + /** + * The job schedule you are attempting to add already exists in the Batch account. + */ + public static final String JobScheduleExists = "JobScheduleExists"; + + /** + * The job schedule on which an operation was attempted does not exist. + */ + public static final String JobScheduleNotFound = "JobScheduleNotFound"; + + /** + * The specified job is disabled. + */ + public static final String JobDisabled = "JobDisabled"; + + /** + * A job with the specified job schedule ID exists. Job and job schedule cannot have the same ID. + */ + public static final String JobWithSameIdExists = "JobWithSameIdExists"; + + /** + * A job schedule with the specified job ID exists. Job and job schedule cannot have the same ID. + */ + public static final String JobScheduleWithSameIdExists = "JobScheduleWithSameIdExists"; + + // General + + /** + * The Batch service failed to authenticate the request. + */ + public static final String AuthenticationFailed = "AuthenticationFailed"; + + /** + * A read operation included a HTTP conditional header, and the condition was not met. + */ + public static final String ConditionNotMet = "ConditionNotMet"; + + /** + * An add or update request specified a metadata item whose key is an empty string. + */ + public static final String EmptyMetadataKey = "EmptyMetadataKey"; + + /** + * The host information was missing from the HTTP request. + */ + public static final String HostInformationNotPresent = "HostInformationNotPresent"; + + /** + * The account being accessed does not have sufficient permissions to execute this operation. + */ + public static final String InsufficientAccountPermissions = "InsufficientAccountPermissions"; + + /** + * An internal error occurred in the Batch service. + */ + public static final String InternalError = "InternalError"; + + /** + * The authentication credentials were not provided in the correct format. + */ + public static final String InvalidAuthenticationInfo = "InvalidAuthenticationInfo"; + + /** + * The specified auto-scale settings are not valid. + */ + public static final String InvalidAutoScalingSettings = "InvalidAutoScalingSettings"; + + /** + * The value of one of the HTTP headers was in an incorrect format. + */ + public static final String InvalidHeaderValue = "InvalidHeaderValue"; + + /** + * The Batch service did not recognize the HTTP verb used for the request. + */ + public static final String InvalidHttpVerb = "InvalidHttpVerb"; + + /** + * One of the request inputs is not valid. + */ + public static final String InvalidInput = "InvalidInput"; + + /** + * An add or update request specified a metadata item which contains characters that are not permitted. + */ + public static final String InvalidMetadata = "InvalidMetadata"; + + /** + * The value of a property in the HTTP request body is invalid. + */ + public static final String InvalidPropertyValue = "InvalidPropertyValue"; + + /** + * The HTTP request body is not syntactically valid. + */ + public static final String InvalidRequestBody = "InvalidRequestBody"; + + /** + * The HTTP request URI contained invalid value for one of the query parameters. + */ + public static final String InvalidQueryParameterValue = "InvalidQueryParameterValue"; + + /** + * The specified byte range is invalid for the given resource. + */ + public static final String InvalidRange = "InvalidRange"; + + /** + * The HTTP request URI was invalid. + */ + public static final String InvalidUri = "InvalidUri"; + + /** + * The size of the metadata exceeds the maximum permitted. + */ + public static final String MetadataTooLarge = "MetadataTooLarge"; + + /** + * The HTTP Content-Length header was not specified. + */ + public static final String MissingContentLengthHeader = "MissingContentLengthHeader"; + + /** + * A required HTTP header was not specified. + */ + public static final String MissingRequiredHeader = "MissingRequiredHeader"; + + /** + * A required property was not specified in the HTTP request body. + */ + public static final String MissingRequiredProperty = "MissingRequiredProperty"; + + /** + * A required query parameter was not specified in the URL. + */ + public static final String MissingRequiredQueryParameter = "MissingRequiredQueryParameter"; + + /** + * Multiple condition headers are not supported. + */ + public static final String MultipleConditionHeadersNotSupported = "MultipleConditionHeadersNotSupported"; + + /** + * The operation is not implemented. + */ + public static final String NotImplemented = "NotImplemented"; + + /** + * One of the request inputs is out of range. + */ + public static final String OutOfRangeInput = "OutOfRangeInput"; + + /** + * A query parameter in the request URL is out of range. + */ + public static final String OutOfRangeQueryParameterValue = "OutOfRangeQueryParameterValue"; + + /** + * The operation could not be completed within the permitted time. + */ + public static final String OperationTimedOut = "OperationTimedOut"; + + /** + * The size of the HTTP request body exceeds the maximum permitted. + */ + public static final String RequestBodyTooLarge = "RequestBodyTooLarge"; + + /** + * The Batch service could not parse the request URL. + */ + public static final String RequestUrlFailedToParse = "RequestUrlFailedToParse"; + + /** + * The specified resource does not exist. + */ + public static final String ResourceNotFound = "ResourceNotFound"; + + /** + * The specified resource already exists. + */ + public static final String ResourceAlreadyExists = "ResourceAlreadyExists"; + + /** + * The resource does not match the expected type. + */ + public static final String ResourceTypeMismatch = "ResourceTypeMismatch"; + + /** + * The Batch service is currently unable to receive requests. + */ + public static final String ServerBusy = "ServerBusy"; + + /** + * One of the HTTP headers specified in the request is not supported. + */ + public static final String UnsupportedHeader = "UnsupportedHeader"; + + /** + * The resource does not support the specified HTTP verb. + */ + public static final String UnsupportedHttpVerb = "UnsupportedHttpVerb"; + + /** + * The Batch service does not support the specified version of the HTTP protocol. + */ + public static final String UnsupportedHttpVersion = "UnsupportedHttpVersion"; + + /** + * One of the properties specified in the HTTP request body is not supported. + */ + public static final String UnsupportedProperty = "UnsupportedProperty"; + + /** + * One of the query parameters specified in the URL is not supported. + */ + public static final String UnsupportedQueryParameter = "UnsupportedQueryParameter"; +} + diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/BehaviorManager.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/BehaviorManager.java new file mode 100644 index 000000000000..b2a72a4850ef --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/BehaviorManager.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.batch.interceptor.DetailLevelInterceptor; +import com.microsoft.azure.batch.interceptor.RequestInterceptor; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; + +class BehaviorManager { + + private Collection perCallBehaviors; + private Collection baseBehaviors; + + BehaviorManager(Collection baseBehaviors, Iterable perCallBehaviors) { + this.baseBehaviors = new LinkedList<>(); + + if (null != baseBehaviors) { + this.baseBehaviors().addAll(baseBehaviors); + } + + this.perCallBehaviors = new LinkedList<>(); + + if (null != perCallBehaviors) { + for (BatchClientBehavior bh : perCallBehaviors) { + this.perCallBehaviors().add(bh); + } + } + } + + Collection getMasterListOfBehaviors() { + List ml = new LinkedList<>(this.baseBehaviors()); + + ml.addAll(this.perCallBehaviors()); + + return ml; + } + + void applyRequestBehaviors(Object request) { + for (BatchClientBehavior bh : getMasterListOfBehaviors()) { + if (bh instanceof RequestInterceptor) { + ((RequestInterceptor) bh).handler().modify(request); + } + } + } + + void appendDetailLevelToPerCallBehaviors(DetailLevel dl) { + if (dl != null) { + this.perCallBehaviors().add(new DetailLevelInterceptor(dl)); + } + } + + private Collection baseBehaviors() { + return baseBehaviors; + } + + public BehaviorManager withBaseBehaviors(Collection baseBehaviors) { + this.baseBehaviors = baseBehaviors; + return this; + } + + private Collection perCallBehaviors() { + return perCallBehaviors; + } + + public BehaviorManager withPerCallBehaviors(Collection perCallBehaviors) { + this.perCallBehaviors = perCallBehaviors; + return this; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java new file mode 100644 index 000000000000..302ea2675c9a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java @@ -0,0 +1,323 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.Certificate; +import com.microsoft.azure.batch.protocol.models.CertificateAddOptions; +import com.microsoft.azure.batch.protocol.models.CertificateAddParameter; +import com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionOptions; +import com.microsoft.azure.batch.protocol.models.CertificateDeleteOptions; +import com.microsoft.azure.batch.protocol.models.CertificateFormat; +import com.microsoft.azure.batch.protocol.models.CertificateGetOptions; +import com.microsoft.azure.batch.protocol.models.CertificateListOptions; +import org.apache.commons.codec.binary.Base64; + +import java.io.IOException; +import java.io.InputStream; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateEncodingException; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.Collection; + +/** + * Performs certificate-related operations on an Azure Batch account. + */ +public class CertificateOperations implements IInheritedBehaviors { + + private Collection customBehaviors; + + private final BatchClient parentBatchClient; + + /** + * The SHA certificate algorithm. + */ + public static final String SHA1_CERTIFICATE_ALGORITHM = "sha1"; + + CertificateOperations(BatchClient batchClient, Iterable inheritedBehaviors) { + parentBatchClient = batchClient; + + // inherit from instantiating parent + InternalHelper.InheritClientBehaviorsAndSetPublicProperty(this, inheritedBehaviors); + } + + /** + * Gets a collection of behaviors that modify or customize requests to the Batch service. + * + * @return A collection of {@link BatchClientBehavior} instances. + */ + @Override + public Collection customBehaviors() { + return customBehaviors; + } + + /** + * Sets a collection of behaviors that modify or customize requests to the Batch service. + * + * @param behaviors The collection of {@link BatchClientBehavior} instances. + * @return The current instance. + */ + @Override + public IInheritedBehaviors withCustomBehaviors(Collection behaviors) { + customBehaviors = behaviors; + return this; + } + + private static String getThumbPrint(java.security.cert.Certificate cert) throws NoSuchAlgorithmException, CertificateEncodingException { + MessageDigest md = MessageDigest.getInstance("SHA-1"); + byte[] der = cert.getEncoded(); + md.update(der); + byte[] digest = md.digest(); + return hexify(digest); + } + + private static String hexify (byte bytes[]) { + char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + + StringBuilder buf = new StringBuilder(bytes.length * 2); + + for (byte b : bytes) { + buf.append(hexDigits[(b & 0xf0) >> 4]); + buf.append(hexDigits[b & 0x0f]); + } + + return buf.toString(); + } + + /** + * Adds a certificate to the Batch account. + * + * @param certStream The certificate data in .cer format. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + * @throws CertificateException Exception thrown when an error is encountered processing the provided certificate. + * @throws NoSuchAlgorithmException Exception thrown if the X.509 provider is not registered in the Java security provider list. + */ + public void createCertificate(InputStream certStream) throws BatchErrorException, IOException, CertificateException, NoSuchAlgorithmException { + createCertificate(certStream, null); + } + + /** + * Adds a certificate to the Batch account. + * + * @param certStream The certificate data in .cer format. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + * @throws CertificateException Exception thrown when an error is encountered processing the provided certificate. + * @throws NoSuchAlgorithmException Exception thrown if the X.509 provider is not registered in the Java security provider list. + */ + public void createCertificate(InputStream certStream, Iterable additionalBehaviors) throws BatchErrorException, IOException, CertificateException, NoSuchAlgorithmException { + CertificateFactory x509CertFact = CertificateFactory.getInstance("X.509"); + X509Certificate cert = (X509Certificate) x509CertFact.generateCertificate(certStream); + + CertificateAddParameter addParam = new CertificateAddParameter() + .withCertificateFormat(CertificateFormat.CER) + .withThumbprintAlgorithm(SHA1_CERTIFICATE_ALGORITHM) + .withThumbprint(getThumbPrint(cert)) + .withData(Base64.encodeBase64String(cert.getEncoded())); + + createCertificate(addParam, additionalBehaviors); + } + + /** + * Adds a certificate to the Batch account. + * + * @param certificate The certificate to be added. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void createCertificate(CertificateAddParameter certificate) throws BatchErrorException, IOException { + createCertificate(certificate, null); + } + + /** + * Adds a certificate to the Batch account. + * + * @param certificate The certificate to be added. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void createCertificate(CertificateAddParameter certificate, Iterable additionalBehaviors) throws BatchErrorException, IOException { + CertificateAddOptions options = new CertificateAddOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this.parentBatchClient.protocolLayer().certificates().add(certificate, options); + } + + /** + * Cancels a failed deletion of the specified certificate. This operation can be performed only when + * the certificate is in the {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETE_FAILED Delete Failed} state, and restores + * the certificate to the {@link com.microsoft.azure.batch.protocol.models.CertificateState#ACTIVE Active} state. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate that failed to delete. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void cancelDeleteCertificate(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException { + cancelDeleteCertificate(thumbprintAlgorithm, thumbprint, null); + } + + /** + * Cancels a failed deletion of the specified certificate. This operation can be performed only when + * the certificate is in the {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETE_FAILED Delete Failed} state, and restores + * the certificate to the {@link com.microsoft.azure.batch.protocol.models.CertificateState#ACTIVE Active} state. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate that failed to delete. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void cancelDeleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable additionalBehaviors) throws BatchErrorException, IOException { + CertificateCancelDeletionOptions options = new CertificateCancelDeletionOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this.parentBatchClient.protocolLayer().certificates().cancelDeletion(thumbprintAlgorithm, thumbprint, options); + } + + /** + * Deletes the certificate from the Batch account. + *

The delete operation requests that the certificate be deleted. The request puts the certificate in the {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETING Deleting} state. + * The Batch service will perform the actual certificate deletion without any further client action.

+ *

You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that:

+ *
    + *
  • The certificate is not associated with any pools.
  • + *
  • The certificate is not installed on any compute nodes. (Even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart.)
  • + *
+ *

If you try to delete a certificate that is in use, the deletion fails. The certificate state changes to {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETE_FAILED Delete Failed}. + * You can use {@link #cancelDeleteCertificate(String, String)} to set the status back to Active if you decide that you want to continue using the certificate.

+ * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to delete. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteCertificate(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException { + deleteCertificate(thumbprintAlgorithm, thumbprint, null); + } + + /** + * Deletes the certificate from the Batch account. + *

The delete operation requests that the certificate be deleted. The request puts the certificate in the {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETING Deleting} state. + * The Batch service will perform the actual certificate deletion without any further client action.

+ *

You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that:

+ *
    + *
  • The certificate is not associated with any pools.
  • + *
  • The certificate is not installed on any compute nodes. (Even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart.)
  • + *
+ *

If you try to delete a certificate that is in use, the deletion fails. The certificate state changes to {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETE_FAILED Delete Failed}. + * + * You can use {@link #cancelDeleteCertificate(String, String)} to set the status back to Active if you decide that you want to continue using the certificate.

+ * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to delete. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable additionalBehaviors) throws BatchErrorException, IOException { + CertificateDeleteOptions options = new CertificateDeleteOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this.parentBatchClient.protocolLayer().certificates().delete(thumbprintAlgorithm, thumbprint, options); + } + + /** + * Gets the specified {@link Certificate}. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @return A {@link Certificate} containing information about the specified certificate in the Azure Batch account. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public Certificate getCertificate(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException { + return getCertificate(thumbprintAlgorithm, thumbprint, null, null); + } + + /** + * Gets the specified {@link Certificate}. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service. + * @return A {@link Certificate} containing information about the specified certificate in the Azure Batch account. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public Certificate getCertificate(String thumbprintAlgorithm, String thumbprint, DetailLevel detailLevel) throws BatchErrorException, IOException { + return getCertificate(thumbprintAlgorithm, thumbprint, detailLevel, null); + } + + /** + * Gets the specified {@link Certificate}. + * + * @param thumbprintAlgorithm the algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint the thumbprint of the certificate to get. + * @param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A {@link Certificate} containing information about the specified certificate in the Azure Batch account. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public Certificate getCertificate(String thumbprintAlgorithm, String thumbprint, DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + CertificateGetOptions getCertificateOptions = new CertificateGetOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(getCertificateOptions); + + return this.parentBatchClient.protocolLayer().certificates().get(thumbprintAlgorithm, thumbprint, getCertificateOptions); + } + + /** + * Lists the {@link Certificate certificates} in the Batch account. + * + * @return A list of {@link Certificate} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listCertificates() throws BatchErrorException, IOException { + return listCertificates(null, null); + } + + /** + * Lists the {@link Certificate certificates} in the Batch account. + * + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @return A list of {@link Certificate} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listCertificates(DetailLevel detailLevel) throws BatchErrorException, IOException { + return listCertificates(detailLevel, null); + } + + /** + * Lists the {@link Certificate certificates} in the Batch account. + * + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A list of {@link Certificate} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listCertificates(DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + + CertificateListOptions certificateListOptions = new CertificateListOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(certificateListOptions); + + return this.parentBatchClient.protocolLayer().certificates().list(certificateListOptions); + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java new file mode 100644 index 000000000000..698b673a81e7 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java @@ -0,0 +1,565 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.batch.protocol.models.*; +import org.joda.time.DateTime; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +/** + * Performs compute node-related operations on an Azure Batch account. + */ +public class ComputeNodeOperations implements IInheritedBehaviors { + + private Collection _customBehaviors; + + private BatchClient _parentBatchClient; + + ComputeNodeOperations(BatchClient batchClient, Iterable inheritedBehaviors) { + _parentBatchClient = batchClient; + + // inherit from instantiating parent + InternalHelper.InheritClientBehaviorsAndSetPublicProperty(this, inheritedBehaviors); + } + + /** + * Gets a collection of behaviors that modify or customize requests to the Batch service. + * + * @return A collection of {@link BatchClientBehavior} instances. + */ + @Override + public Collection customBehaviors() { + return _customBehaviors; + } + + /** + * Sets a collection of behaviors that modify or customize requests to the Batch service. + * + * @param behaviors The collection of {@link BatchClientBehavior} instances. + * @return The current instance. + */ + @Override + public IInheritedBehaviors withCustomBehaviors(Collection behaviors) { + _customBehaviors = behaviors; + return this; + } + + /** + * Adds a user account to the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node where the user account will be created. + * @param user The user account to be created. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void addComputeNodeUser(String poolId, String nodeId, ComputeNodeUser user) throws BatchErrorException, IOException { + addComputeNodeUser(poolId, nodeId, user, null); + } + + /** + * Adds a user account to the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node where the user account will be created. + * @param user The user account to be created. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void addComputeNodeUser(String poolId, String nodeId, ComputeNodeUser user, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ComputeNodeAddUserOptions options = new ComputeNodeAddUserOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().computeNodes().addUser(poolId, nodeId, user, options); + } + + /** + * Deletes the specified user account from the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node where the user account will be deleted. + * @param userName The name of the user account to be deleted. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteComputeNodeUser(String poolId, String nodeId, String userName) throws BatchErrorException, IOException { + deleteComputeNodeUser(poolId, nodeId, userName, null); + } + + /** + * Deletes the specified user account from the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node where the user account will be deleted. + * @param userName The name of the user account to be deleted. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteComputeNodeUser(String poolId, String nodeId, String userName, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ComputeNodeDeleteUserOptions options = new ComputeNodeDeleteUserOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().computeNodes().deleteUser(poolId, nodeId, userName, options); + } + + /** + * Updates the specified user account on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node where the user account will be updated. + * @param userName The name of the user account to update. + * @param password The password of the account. If null, the password is removed. + * @param expiryTime The time at which the account should expire. If null, the expiry time is replaced with its default value. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void updateComputeNodeUser(String poolId, String nodeId, String userName, String password, DateTime expiryTime) throws BatchErrorException, IOException { + updateComputeNodeUser(poolId, nodeId, userName, password, expiryTime, null); + } + + /** + * Updates the specified user account on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node where the user account will be updated. + * @param userName The name of the user account to update. + * @param password The password of the account. If null, the password is removed. + * @param expiryTime The time at which the account should expire. If null, the expiry time is replaced with its default value. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void updateComputeNodeUser(String poolId, String nodeId, String userName, String password, DateTime expiryTime, Iterable additionalBehaviors) throws BatchErrorException, IOException { + NodeUpdateUserParameter param = new NodeUpdateUserParameter(); + param.withPassword(password); + param.withExpiryTime(expiryTime); + + updateComputeNodeUser(poolId, nodeId, userName, param, additionalBehaviors); + } + + /** + * Updates the specified user account on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node where the user account will be updated. + * @param userName The name of the user account to update. + * @param sshPublicKey The SSH public key that can be used for remote login to the compute node. If null, the SSH public key is removed. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void updateComputeNodeUser(String poolId, String nodeId, String userName, String sshPublicKey) throws BatchErrorException, IOException { + updateComputeNodeUser(poolId, nodeId, userName, sshPublicKey, (Iterable)null); + } + + /** + * Updates the specified user account on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node where the user account will be updated. + * @param userName The name of the user account to update. + * @param sshPublicKey The SSH public key that can be used for remote login to the compute node. If null, the SSH public key is removed. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void updateComputeNodeUser(String poolId, String nodeId, String userName, String sshPublicKey, Iterable additionalBehaviors) throws BatchErrorException, IOException { + NodeUpdateUserParameter param = new NodeUpdateUserParameter(); + param.withSshPublicKey(sshPublicKey); + + updateComputeNodeUser(poolId, nodeId, userName, param, additionalBehaviors); + } + + /** + * Updates the specified user account on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node where the user account will be updated. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The set of changes to be made to the user account. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + private void updateComputeNodeUser(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ComputeNodeUpdateUserOptions options = new ComputeNodeUpdateUserOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().computeNodes().updateUser(poolId, nodeId, userName, nodeUpdateUserParameter, options); + } + + /** + * Gets the specified compute node. + * + * @param poolId The ID of the pool. + * @param nodeId the ID of the compute node to get from the pool. + * @return A {@link ComputeNode} containing information about the specified compute node. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public ComputeNode getComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException { + return getComputeNode(poolId, nodeId, null, null); + } + + /** + * Gets the specified compute node. + * + * @param poolId The ID of the pool. + * @param nodeId The ID of the compute node to get from the pool. + * @param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service. + * @return A {@link ComputeNode} containing information about the specified compute node. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public ComputeNode getComputeNode(String poolId, String nodeId, DetailLevel detailLevel) throws BatchErrorException, IOException { + return getComputeNode(poolId, nodeId, detailLevel, null); + } + + /** + * Gets the specified compute node. + * + * @param poolId The ID of the pool. + * @param nodeId The ID of the compute node to get from the pool. + * @param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A {@link ComputeNode} containing information about the specified compute node. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public ComputeNode getComputeNode(String poolId, String nodeId, DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ComputeNodeGetOptions options = new ComputeNodeGetOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().computeNodes().get(poolId, nodeId, options); + } + + /** + * Reboots the specified compute node. + *

You can reboot a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.

+ * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node to reboot. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void rebootComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException { + rebootComputeNode(poolId, nodeId, null, null); + } + + /** + * Reboots the specified compute node. + *

You can reboot a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.

+ * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node to reboot. + * @param nodeRebootOption Specifies when to reboot the node and what to do with currently running tasks. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void rebootComputeNode(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption) throws BatchErrorException, IOException { + rebootComputeNode(poolId, nodeId, nodeRebootOption, null); + } + + /** + * Reboots the specified compute node. + *

You can reboot a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.

+ * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node to reboot. + * @param nodeRebootOption Specifies when to reboot the node and what to do with currently running tasks. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void rebootComputeNode(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ComputeNodeRebootOptions options = new ComputeNodeRebootOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().computeNodes().reboot(poolId, nodeId, nodeRebootOption, options); + } + + /** + * Reinstalls the operating system on the specified compute node. + *

You can reimage a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.

+ * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node to reimage. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void reimageComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException { + reimageComputeNode(poolId, nodeId, null, null); + } + + /** + * Reinstalls the operating system on the specified compute node. + *

You can reimage a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.

+ * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node to reimage. + * @param nodeReimageOption Specifies when to reimage the node and what to do with currently running tasks. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void reimageComputeNode(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption) throws BatchErrorException, IOException { + reimageComputeNode(poolId, nodeId, nodeReimageOption, null); + } + + /** + * Reinstalls the operating system on the specified compute node. + *

You can reimage a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.

+ * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node to reimage. + * @param nodeReimageOption Specifies when to reimage the node and what to do with currently running tasks. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void reimageComputeNode(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ComputeNodeReimageOptions options = new ComputeNodeReimageOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().computeNodes().reimage(poolId, nodeId, nodeReimageOption, options); + } + + /** + * Disables task scheduling on the specified compute node. + * + * @param poolId The ID of the pool. + * @param nodeId the ID of the compute node. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void disableComputeNodeScheduling(String poolId, String nodeId) throws BatchErrorException, IOException { + disableComputeNodeScheduling(poolId, nodeId, null, null); + } + + /** + * Disables task scheduling on the specified compute node. + * + * @param poolId The ID of the pool. + * @param nodeId The ID of the compute node. + * @param nodeDisableSchedulingOption Specifies what to do with currently running tasks. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void disableComputeNodeScheduling(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption) throws BatchErrorException, IOException { + disableComputeNodeScheduling(poolId, nodeId, nodeDisableSchedulingOption, null); + } + + /** + * Disables task scheduling on the specified compute node. + * + * @param poolId The ID of the pool. + * @param nodeId The ID of the compute node. + * @param nodeDisableSchedulingOption Specifies what to do with currently running tasks. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void disableComputeNodeScheduling(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ComputeNodeDisableSchedulingOptions options = new ComputeNodeDisableSchedulingOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().computeNodes().disableScheduling(poolId, nodeId, nodeDisableSchedulingOption, options); + } + + /** + * Enables task scheduling on the specified compute node. + * + * @param poolId The ID of the pool. + * @param nodeId The ID of the compute node. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void enableComputeNodeScheduling(String poolId, String nodeId) throws BatchErrorException, IOException { + enableComputeNodeScheduling(poolId, nodeId, null); + } + + /** + * Enables task scheduling on the specified compute node. + * + * @param poolId The ID of the pool. + * @param nodeId The ID of the compute node. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void enableComputeNodeScheduling(String poolId, String nodeId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ComputeNodeEnableSchedulingOptions options = new ComputeNodeEnableSchedulingOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().computeNodes().enableScheduling(poolId, nodeId, options); + } + + /** + * Gets a Remote Desktop Protocol (RDP) file for the specified node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to get a Remote Desktop file. + * @return The RDP file contents. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public String getComputeNodeRemoteDesktop(String poolId, String nodeId) throws BatchErrorException, IOException { + return getComputeNodeRemoteDesktop(poolId, nodeId, null); + } + + /** + * Gets a Remote Desktop Protocol (RDP) file for the specified node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to get a Remote Desktop file. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return The RDP file contents. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public String getComputeNodeRemoteDesktop(String poolId, String nodeId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ComputeNodeGetRemoteDesktopOptions options = new ComputeNodeGetRemoteDesktopOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + this._parentBatchClient.protocolLayer().computeNodes().getRemoteDesktop(poolId, nodeId, options, outputStream); + String rdpContent = outputStream.toString("UTF-8"); + outputStream.close(); + return rdpContent; + } + + /** + * Gets the settings required for remote login to a compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to get a remote login settings. + * @return The remote settings for the specified compute node. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public ComputeNodeGetRemoteLoginSettingsResult getComputeNodeRemoteLoginSettings(String poolId, String nodeId) throws BatchErrorException, IOException { + return getComputeNodeRemoteLoginSettings(poolId, nodeId, null); + } + + /** + * Gets the settings required for remote login to a compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to get a remote login settings. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return The remote login settings for the specified compute node. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public ComputeNodeGetRemoteLoginSettingsResult getComputeNodeRemoteLoginSettings(String poolId, String nodeId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ComputeNodeGetRemoteLoginSettingsOptions options = new ComputeNodeGetRemoteLoginSettingsOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().computeNodes().getRemoteLoginSettings(poolId, nodeId, options); + } + + /** + * Lists the {@link ComputeNode compute nodes} of the specified pool. + * + * @param poolId The ID of the pool. + * @return A list of {@link ComputeNode} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listComputeNodes(String poolId) throws BatchErrorException, IOException { + return listComputeNodes(poolId, null, null); + } + + /** + * Lists the {@link ComputeNode compute nodes} of the specified pool. + * + * @param poolId The ID of the pool. + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @return A list of {@link ComputeNode} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listComputeNodes(String poolId, DetailLevel detailLevel) throws BatchErrorException, IOException { + return listComputeNodes(poolId, detailLevel, null); + } + + /** + * Lists the {@link ComputeNode compute nodes} of the specified pool. + * + * @param poolId The ID of the pool. + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A list of {@link ComputeNode} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listComputeNodes(String poolId, DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + ComputeNodeListOptions options = new ComputeNodeListOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().computeNodes().list(poolId, options); + } + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param containerUrl The URL of the container within Azure Blob Storage to which to upload the Batch Service log file(s). + * @param startTime The start of the time range from which to upload Batch Service log file(s). + * @return The result of uploading Batch service log files from a specific compute node. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public UploadBatchServiceLogsResult uploadBatchServiceLogs(String poolId, String nodeId, String containerUrl, DateTime startTime) throws BatchErrorException, IOException { + return uploadBatchServiceLogs(poolId, nodeId, containerUrl, startTime, null, null); + + } + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param containerUrl The URL of the container within Azure Blob Storage to which to upload the Batch Service log file(s). + * @param startTime The start of the time range from which to upload Batch Service log file(s). + * @param endTime The end of the time range from which to upload Batch Service log file(s). + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return The result of uploading Batch service log files from a specific compute node. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public UploadBatchServiceLogsResult uploadBatchServiceLogs(String poolId, String nodeId, String containerUrl, DateTime startTime, DateTime endTime, Iterable additionalBehaviors) throws BatchErrorException, IOException { + UploadBatchServiceLogsConfiguration configuration = new UploadBatchServiceLogsConfiguration(); + configuration.withContainerUrl(containerUrl); + configuration.withStartTime(startTime); + configuration.withEndTime(endTime); + + ComputeNodeUploadBatchServiceLogsOptions options = new ComputeNodeUploadBatchServiceLogsOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().computeNodes().uploadBatchServiceLogs(poolId, nodeId, configuration, options); + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/CreateTasksErrorException.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/CreateTasksErrorException.java new file mode 100644 index 000000000000..3e7fafd4d9f8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/CreateTasksErrorException.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.TaskAddParameter; +import com.microsoft.azure.batch.protocol.models.TaskAddResult; + +import java.util.List; + +import static java.util.Collections.unmodifiableList; + +/** + * The exception that is thrown when the {@link TaskOperations#createTasks(String, List)} operation is terminated. + */ +public class CreateTasksErrorException extends BatchErrorException { + + /** + * Initializes a new instance of the CreateTasksErrorException class. + * + * @param message The exception message. + * @param failureTaskList The list of {@link TaskAddResult} instances containing failure details for tasks that were not successfully created. + * @param pendingTaskList The list of {@link TaskAddParameter} instances containing the tasks that were not added, but for which the operation can be retried. + */ + public CreateTasksErrorException(final String message, List failureTaskList, List pendingTaskList) { + super(message, null); + this.failureTaskList = unmodifiableList(failureTaskList); + this.pendingTaskList = unmodifiableList(pendingTaskList); + } + + private List failureTaskList; + + private List pendingTaskList; + + /** + * @return The list of {@link TaskAddResult} instances containing failure details for tasks that were not successfully created. + */ + public List failureTaskList() { + return failureTaskList; + } + + /** + * @return The list of {@link TaskAddParameter} instances containing the tasks that were not added, but for which the operation can be retried. + */ + public List pendingTaskList() { + return pendingTaskList; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/DetailLevel.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/DetailLevel.java new file mode 100644 index 000000000000..8feaf5820794 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/DetailLevel.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +/** + * Controls the amount of detail requested from the Azure Batch service when listing or + * retrieving resources. + */ +public class DetailLevel { + + private String filterClause; + + private String selectClause; + + private String expandClause; + + /** + * The builder class to initiate a {@link DetailLevel} instance. + */ + public static class Builder { + + private String filterClause; + + private String selectClause; + + private String expandClause; + + /** + * Initializes a new instance of the Builder class. + */ + public Builder() {} + + /** + * Sets the OData filter clause. Used to restrict a list operation to items that match specified criteria. + * + * @param filter The filter clause. + * @return The Builder instance. + */ + public Builder withFilterClause(String filter) { + this.filterClause = filter; + return this; + } + + /** + * Sets the OData select clause. Used to retrieve only specific properties instead of all object properties. + * + * @param select The select clause. + * @return The Builder instance. + */ + public Builder withSelectClause(String select) { + this.selectClause = select; + return this; + } + + /** + * Sets the OData expand clause. Used to retrieve associated entities of the main entity being retrieved. + * + * @param expand The expand clause. + * @return The Builder instance. + */ + public Builder withExpandClause(String expand) { + this.expandClause = expand; + return this; + } + + /** + * Create a DetailLevel class instance. + * + * @return A DetailLevel instance. + */ + public DetailLevel build() { + return new DetailLevel(this); + } + } + + /** + * Gets the OData filter clause. Used to restrict a list operation to items that match specified criteria. + * + * @return The filter clause. + */ + public String filterClause() { + return filterClause; + } + + /** + * Gets the OData select clause. Used to retrieve only specific properties instead of all object properties. + * + * @return The select clause. + */ + public String selectClause() { + return selectClause; + } + + /** + * Gets the OData expand clause. Used to retrieve associated entities of the main entity being retrieved. + * + * @return The expand clause. + */ + public String expandClause() { + return expandClause; + } + + private DetailLevel(Builder b) { + this.selectClause = b.selectClause; + this.expandClause = b.expandClause; + this.filterClause = b.filterClause; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java new file mode 100644 index 000000000000..439dacebe7bc --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.FileDeleteFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileDeleteFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.FileGetFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileGetFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromComputeNodeHeaders; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromTaskHeaders; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.FileListFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileListFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.FileProperties; +import com.microsoft.azure.batch.protocol.models.NodeFile; +import com.microsoft.rest.ServiceResponseWithHeaders; + +import java.io.*; +import java.util.Collection; +import java.util.List; + +/** + * Performs file-related operations on an Azure Batch account. + */ +public class FileOperations implements IInheritedBehaviors { + + private Collection _customBehaviors; + + private final BatchClient _parentBatchClient; + + FileOperations(BatchClient batchClient, Iterable inheritedBehaviors) { + _parentBatchClient = batchClient; + + // inherit from instantiating parent + InternalHelper.InheritClientBehaviorsAndSetPublicProperty(this, inheritedBehaviors); + } + + /** + * Gets a collection of behaviors that modify or customize requests to the Batch service. + * + * @return A collection of {@link BatchClientBehavior} instances. + */ + @Override + public Collection customBehaviors() { + return _customBehaviors; + } + + /** + * Sets a collection of behaviors that modify or customize requests to the Batch service. + * + * @param behaviors The collection of {@link BatchClientBehavior} instances. + * @return The current instance. + */ + @Override + public IInheritedBehaviors withCustomBehaviors(Collection behaviors) { + _customBehaviors = behaviors; + return this; + } + + /** + * Lists the files in the specified task's directory on its compute node. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @return A list of {@link NodeFile} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listFilesFromTask(String jobId, String taskId) throws BatchErrorException, IOException { + return listFilesFromTask(jobId, taskId, null, null, null); + } + + /** + * Lists the files in the specified task's directory on its compute node. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @param recursive If true, performs a recursive list of all files of the task. If false or null, returns only the files in the root task directory. + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @return A list of {@link NodeFile} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listFilesFromTask(String jobId, String taskId, Boolean recursive, DetailLevel detailLevel) throws BatchErrorException, IOException { + return listFilesFromTask(jobId, taskId, recursive, detailLevel, null); + } + + /** + * Lists the files in the specified task's directory on its compute node. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @param recursive If true, performs a recursive list of all files of the task. If false or null, returns only the files in the root task directory. + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A list of {@link NodeFile} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listFilesFromTask(String jobId, String taskId, Boolean recursive, DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + FileListFromTaskOptions options = new FileListFromTaskOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().files().listFromTask(jobId, taskId, recursive, options); + } + + /** + * Lists files on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node. + * @return A list of {@link NodeFile} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listFilesFromComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException { + return listFilesFromComputeNode(poolId, nodeId, null, null, null); + } + + /** + * Lists files on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node. + * @param recursive If true, recursively lists all files on the compute node. If false or null, lists only the files in the compute node root directory. + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @return A list of {@link NodeFile} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listFilesFromComputeNode(String poolId, String nodeId, Boolean recursive, DetailLevel detailLevel) throws BatchErrorException, IOException { + return listFilesFromComputeNode(poolId, nodeId, recursive, detailLevel, null); + } + + /** + * Lists files on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node. + * @param recursive If true, recursively lists all files on the compute node. If false or null, lists only the files in the compute node root directory. + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A list of {@link NodeFile} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listFilesFromComputeNode(String poolId, String nodeId, Boolean recursive, DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + FileListFromComputeNodeOptions options = new FileListFromComputeNodeOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().files().listFromComputeNode(poolId, nodeId, recursive, options); + } + + /** + * Deletes the specified file from the specified task's directory on its compute node. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task. + * @param fileName The name of the file to delete. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteFileFromTask(String jobId, String taskId, String fileName) throws BatchErrorException, IOException { + deleteFileFromTask(jobId, taskId, fileName, null, null); + } + + /** + * Deletes the specified file from the specified task's directory on its compute node. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task. + * @param fileName The name of the file to delete. + * @param recursive If the file-path parameter represents a directory instead of a file, you can set the recursive parameter to true to delete the directory and all of the files and subdirectories in it. If recursive is false or null, then the directory must be empty or deletion will fail. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteFileFromTask(String jobId, String taskId, String fileName, Boolean recursive) throws BatchErrorException, IOException { + deleteFileFromTask(jobId, taskId, fileName, recursive, null); + } + + /** + * Deletes the specified file from the specified task's directory on its compute node. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task. + * @param fileName The name of the file to delete. + * @param recursive If the file-path parameter represents a directory instead of a file, you can set the recursive parameter to true to delete the directory and all of the files and subdirectories in it. If recursive is false or null, then the directory must be empty or deletion will fail. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteFileFromTask(String jobId, String taskId, String fileName, Boolean recursive, Iterable additionalBehaviors) throws BatchErrorException, IOException { + FileDeleteFromTaskOptions options = new FileDeleteFromTaskOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().files().deleteFromTask(jobId, taskId, fileName, recursive, options); + } + + /** + * Deletes the specified file from the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node. + * @param fileName The name of the file to delete. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteFileFromComputeNode(String poolId, String nodeId, String fileName) throws BatchErrorException, IOException { + deleteFileFromComputeNode(poolId, nodeId, fileName, null, null); + } + + /** + * Deletes the specified file from the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node. + * @param fileName The name of the file to delete. + * @param recursive If the file-path parameter represents a directory instead of a file, you can set the recursive parameter to true to delete the directory and all of the files and subdirectories in it. If recursive is false or null, then the directory must be empty or deletion will fail. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteFileFromComputeNode(String poolId, String nodeId, String fileName, Boolean recursive) throws BatchErrorException, IOException { + deleteFileFromComputeNode(poolId, nodeId, fileName, recursive, null); + } + + /** + * Deletes the specified file from the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node. + * @param fileName The name of the file to delete. + * @param recursive If the file-path parameter represents a directory instead of a file, you can set the recursive parameter to true to delete the directory and all of the files and subdirectories in it. If recursive is false or null, then the directory must be empty or deletion will fail. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteFileFromComputeNode(String poolId, String nodeId, String fileName, Boolean recursive, Iterable additionalBehaviors) throws BatchErrorException, IOException { + FileDeleteFromComputeNodeOptions options = new FileDeleteFromComputeNodeOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().files().deleteFromComputeNode(poolId, nodeId, fileName, recursive, options); + } + + /** + * Downloads the specified file from the specified task's directory on its compute node. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task. + * @param fileName The name of the file to download. + * @param outputStream A stream into which the file contents will be written. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void getFileFromTask(String jobId, String taskId, String fileName, OutputStream outputStream) throws BatchErrorException, IOException { + getFileFromTask(jobId, taskId, fileName, null, outputStream); + } + + /** + * Downloads the specified file from the specified task's directory on its compute node. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task. + * @param fileName The name of the file to download. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @param outputStream A stream into which the file contents will be written. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void getFileFromTask(String jobId, String taskId, String fileName, Iterable additionalBehaviors, OutputStream outputStream) throws BatchErrorException, IOException { + FileGetFromTaskOptions options = new FileGetFromTaskOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().files().getFromTask(jobId, taskId, fileName, options, outputStream); + } + + /** + * Downloads the specified file from the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node. + * @param fileName The name of the file to download. + * @param outputStream A stream into which the file contents will be written. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void getFileFromComputeNode(String poolId, String nodeId, String fileName, OutputStream outputStream) throws BatchErrorException, IOException { + getFileFromComputeNode(poolId, nodeId, fileName, null, outputStream); + } + + /** + * Downloads the specified file from the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node. + * @param fileName The name of the file to download. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @param outputStream A stream into which the file contents will be written. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void getFileFromComputeNode(String poolId, String nodeId, String fileName, Iterable additionalBehaviors, OutputStream outputStream) throws BatchErrorException, IOException { + FileGetFromComputeNodeOptions options = new FileGetFromComputeNodeOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().files().getFromComputeNode(poolId, nodeId, fileName, options, outputStream); + } + + /** + * Gets information about a file from the specified task's directory on its compute node. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task. + * @param fileName The name of the file to retrieve. + * @return A {@link FileProperties} instance containing information about the file. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public FileProperties getFilePropertiesFromTask(String jobId, String taskId, String fileName) throws BatchErrorException, IOException { + return getFilePropertiesFromTask(jobId, taskId, fileName, null); + } + + /** + * Gets information about a file from the specified task's directory on its compute node. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task. + * @param fileName The name of the file to retrieve. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A {@link FileProperties} instance containing information about the file. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public FileProperties getFilePropertiesFromTask(String jobId, String taskId, String fileName, Iterable additionalBehaviors) throws BatchErrorException, IOException { + FileGetPropertiesFromTaskOptions options = new FileGetPropertiesFromTaskOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + ServiceResponseWithHeaders response = this._parentBatchClient.protocolLayer().files(). + getPropertiesFromTaskWithServiceResponseAsync(jobId, taskId, fileName, options).toBlocking().single(); + + return new FileProperties() + .withContentLength(response.headers().contentLength()) + .withContentType(response.headers().contentType()) + .withCreationTime(response.headers().ocpCreationTime()) + .withLastModified(response.headers().lastModified()) + .withFileMode(response.headers().ocpBatchFileMode()); + } + + /** + * Gets information about a file on a compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId the ID of the compute node. + * @param fileName The name of the file to retrieve. + * @return A {@link FileProperties} instance containing information about the file. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public FileProperties getFilePropertiesFromComputeNode(String poolId, String nodeId, String fileName) throws BatchErrorException, IOException { + return getFilePropertiesFromComputeNode(poolId, nodeId, fileName, null); + } + + /** + * Gets information about a file on a compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId the ID of the compute node. + * @param fileName The name of the file to retrieve. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A {@link FileProperties} instance containing information about the file. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public FileProperties getFilePropertiesFromComputeNode(String poolId, String nodeId, String fileName, Iterable additionalBehaviors) throws BatchErrorException, IOException { + FileGetPropertiesFromComputeNodeOptions options = new FileGetPropertiesFromComputeNodeOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + ServiceResponseWithHeaders response = this._parentBatchClient.protocolLayer().files(). + getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, fileName, options).toBlocking().single(); + + return new FileProperties() + .withContentLength(response.headers().contentLength()) + .withContentType(response.headers().contentType()) + .withCreationTime(response.headers().ocpCreationTime()) + .withLastModified(response.headers().lastModified()) + .withFileMode(response.headers().ocpBatchFileMode()); + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/IInheritedBehaviors.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/IInheritedBehaviors.java new file mode 100644 index 000000000000..530f1e4285d5 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/IInheritedBehaviors.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import java.util.Collection; + +/** + * This interface defines methods and properties that are inherited from the instantiating parent object. + * Classes that implement this interface inherit behaviors when they are instantiated. + * In this model, the collections are independent but the members are shared references. + * Members of this collection alter or customize various behaviors of Azure Batch service client objects. + * These behaviors are generally inherited by any child class instances. + * Modifications are applied in the order of the collection. + * The last write wins. + */ +public interface IInheritedBehaviors { + + /** + * Gets a collection of behaviors that modify or customize requests to the Batch service. + * + * @return A collection of {@link BatchClientBehavior} instances. + */ + Collection customBehaviors(); + + /** + * Sets a collection of behaviors that modify or customize requests to the Batch service. + * + * @param behaviors The collection of {@link BatchClientBehavior} instances. + * @return The current instance. + */ + IInheritedBehaviors withCustomBehaviors(Collection behaviors); + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/InternalHelper.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/InternalHelper.java new file mode 100644 index 000000000000..d05c1aaa0e98 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/InternalHelper.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import java.util.ArrayList; +import java.util.List; + +/** + * Internal helper functions + */ +class InternalHelper { + /** + * Inherit the BatchClientBehavior classes from parent object + * + * @param inheritingObject the inherit object + * @param baseBehaviors base class behavior list + */ + public static void InheritClientBehaviorsAndSetPublicProperty(IInheritedBehaviors inheritingObject, Iterable baseBehaviors) { + // implement inheritance of behaviors + List customBehaviors = new ArrayList<>(); + + // if there were any behaviors, pre-populate the collection (ie: inherit) + if (null != baseBehaviors) + { + for (BatchClientBehavior be : baseBehaviors) + customBehaviors.add(be); + } + + // set the public property + inheritingObject.withCustomBehaviors(customBehaviors); + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java new file mode 100644 index 000000000000..873f9293d7bf --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java @@ -0,0 +1,599 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.batch.protocol.models.*; + +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +/** + * Performs job-related operations on an Azure Batch account. + */ +public class JobOperations implements IInheritedBehaviors { + + private Collection _customBehaviors; + + private final BatchClient _parentBatchClient; + + JobOperations(BatchClient batchClient, Collection inheritedBehaviors) { + _parentBatchClient = batchClient; + + // inherit from instantiating parent + InternalHelper.InheritClientBehaviorsAndSetPublicProperty(this, inheritedBehaviors); + } + + /** + * Gets a collection of behaviors that modify or customize requests to the Batch service. + * + * @return A collection of {@link BatchClientBehavior} instances. + */ + @Override + public Collection customBehaviors() { + return _customBehaviors; + } + + /** + * Sets a collection of behaviors that modify or customize requests to the Batch service. + * + * @param behaviors The collection of {@link BatchClientBehavior} instances. + * @return The current instance. + */ + @Override + public IInheritedBehaviors withCustomBehaviors(Collection behaviors) { + _customBehaviors = behaviors; + return this; + } + + /** + * Gets lifetime summary statistics for all of the jobs in the current account. + * + * @return The aggregated job statistics. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public JobStatistics getAllJobsLifetimeStatistics() throws BatchErrorException, IOException { + return getAllJobsLifetimeStatistics(null); + } + + /** + * Gets lifetime summary statistics for all of the jobs in the current account. + * + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return The aggregated job statistics. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public JobStatistics getAllJobsLifetimeStatistics(Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobGetAllLifetimeStatisticsOptions options = new JobGetAllLifetimeStatisticsOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().jobs().getAllLifetimeStatistics(options); + } + + /** + * Gets the specified {@link CloudJob}. + * + * @param jobId The ID of the job to get. + * @return A {@link CloudJob} containing information about the specified Azure Batch job. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public CloudJob getJob(String jobId) throws BatchErrorException, IOException { + return getJob(jobId, null, null); + } + + /** + * Gets the specified {@link CloudJob}. + * + * @param jobId The ID of the job to get. + * @param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service. + * @return A {@link CloudJob} containing information about the specified Azure Batch job. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public CloudJob getJob(String jobId, DetailLevel detailLevel) throws BatchErrorException, IOException { + return getJob(jobId, detailLevel, null); + } + + /** + * Gets the specified {@link CloudJob}. + * + * @param jobId The ID of the job to get. + * @param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A {@link CloudJob} containing information about the specified Azure Batch job. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public CloudJob getJob(String jobId, DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobGetOptions getJobOptions = new JobGetOptions(); + + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(getJobOptions); + + return this._parentBatchClient.protocolLayer().jobs().get(jobId, getJobOptions); + } + + /** + * Lists the {@link CloudJob jobs} in the Batch account. + * + * @return A list of {@link CloudJob} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listJobs() throws BatchErrorException, IOException { + return listJobs(null, (Iterable) null); + } + + /** + * Lists the {@link CloudJob jobs} in the Batch account. + * + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @return A list of {@link CloudJob} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listJobs(DetailLevel detailLevel) throws BatchErrorException, IOException { + return listJobs(detailLevel, null); + } + + /** + * Lists the {@link CloudJob jobs} in the Batch account. + * + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A list of {@link CloudJob} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listJobs(DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobListOptions jobListOptions = new JobListOptions(); + + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(jobListOptions); + + return this._parentBatchClient.protocolLayer().jobs().list(jobListOptions); + } + + /** + * Lists the {@link CloudJob jobs} created under the specified job schedule. + * + * @param jobScheduleId The ID of job schedule. + * @return A list of {@link CloudJob} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listJobs(String jobScheduleId) throws BatchErrorException, IOException { + return listJobs(jobScheduleId, null, null); + } + + /** + * Lists the {@link CloudJob jobs} created under the specified job schedule. + * + * @param jobScheduleId The ID of job schedule. + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @return A list of {@link CloudJob} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listJobs(String jobScheduleId, DetailLevel detailLevel) throws BatchErrorException, IOException { + return listJobs(jobScheduleId, detailLevel, null); + } + + /** + * Lists the {@link CloudJob jobs} created under the specified jobSchedule. + * + * @param jobScheduleId The ID of jobSchedule. + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A list of {@link CloudJob} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listJobs(String jobScheduleId, DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobListFromJobScheduleOptions jobListOptions = new JobListFromJobScheduleOptions(); + + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(jobListOptions); + + return this._parentBatchClient.protocolLayer().jobs().listFromJobSchedule(jobScheduleId, jobListOptions); + } + + /** + * Lists the status of {@link JobPreparationTask} and {@link JobReleaseTask} tasks for the specified job. + * + * @param jobId The ID of the job. + * @return A list of {@link JobPreparationAndReleaseTaskExecutionInformation} instances. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listPreparationAndReleaseTaskStatus(String jobId) throws BatchErrorException, IOException { + return listPreparationAndReleaseTaskStatus(jobId, null); + } + + /** + * Lists the status of {@link JobPreparationTask} and {@link JobReleaseTask} tasks for the specified job. + * + * @param jobId The ID of the job. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A list of {@link JobPreparationAndReleaseTaskExecutionInformation} instances. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listPreparationAndReleaseTaskStatus(String jobId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobListPreparationAndReleaseTaskStatusOptions jobListOptions = new JobListPreparationAndReleaseTaskStatusOptions(); + + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(jobListOptions); + + return this._parentBatchClient.protocolLayer().jobs().listPreparationAndReleaseTaskStatus(jobId, jobListOptions); + } + + /** + * Adds a job to the Batch account. + * + * @param jobId The ID of the job to be added. + * @param poolInfo Specifies how a job should be assigned to a pool. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void createJob(String jobId, PoolInformation poolInfo) throws BatchErrorException, IOException { + createJob(jobId, poolInfo, null); + } + + /** + * Adds a job to the Batch account. + * + * @param jobId The ID of the job to be added. + * @param poolInfo Specifies how a job should be assigned to a pool. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void createJob(String jobId, PoolInformation poolInfo, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobAddParameter param = new JobAddParameter() + .withId(jobId) + .withPoolInfo(poolInfo); + + createJob(param, additionalBehaviors); + } + + /** + * Adds a job to the Batch account. + * + * @param job The job to be added. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void createJob(JobAddParameter job) throws BatchErrorException, IOException { + createJob(job, null); + } + + /** + * Adds a job to the Batch account. + * + * @param job The job to be added. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void createJob(JobAddParameter job, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobAddOptions options = new JobAddOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().jobs().add(job, options); + } + + /** + * Deletes the specified job. + * + * @param jobId The ID of the job. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteJob(String jobId) throws BatchErrorException, IOException { + deleteJob(jobId, null); + } + + /** + * Deletes the specified job. + * + * @param jobId The ID of the job. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteJob(String jobId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobDeleteOptions options = new JobDeleteOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().jobs().delete(jobId, options); + } + + /** + * Terminates the specified job, marking it as completed. + * + * @param jobId The ID of the job. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void terminateJob(String jobId) throws BatchErrorException, IOException { + terminateJob(jobId, null, null); + } + + /** + * Terminates the specified job, marking it as completed. + * + * @param jobId The ID of the job. + * @param terminateReason The message to describe the reason the job has terminated. This text will appear when you call {@link JobExecutionInformation#terminateReason()}. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void terminateJob(String jobId, String terminateReason) throws BatchErrorException, IOException { + terminateJob(jobId, terminateReason, null); + } + + /** + * Terminates the specified job, marking it as completed. + * + * @param jobId The ID of the job. + * @param terminateReason The message to describe the reason the job has terminated. This text will appear when you call {@link JobExecutionInformation#terminateReason()}. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void terminateJob(String jobId, String terminateReason, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobTerminateOptions options = new JobTerminateOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().jobs().terminate(jobId, terminateReason, options); + } + + /** + * Enables the specified job, allowing new tasks to run. + * + * @param jobId The ID of the job. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void enableJob(String jobId) throws BatchErrorException, IOException { + enableJob(jobId, null); + } + + /** + * Enables the specified job, allowing new tasks to run. + * + * @param jobId The ID of the job. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void enableJob(String jobId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobEnableOptions options = new JobEnableOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().jobs().enable(jobId, options); + } + + /** + * Disables the specified job. Disabled jobs do not run new tasks, but may be re-enabled later. + * + * @param jobId The ID of the job. + * @param disableJobOption Specifies what to do with running tasks associated with the job. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void disableJob(String jobId, DisableJobOption disableJobOption) throws BatchErrorException, IOException { + disableJob(jobId, disableJobOption, null); + } + + /** + * Disables the specified job. Disabled jobs do not run new tasks, but may be re-enabled later. + * + * @param jobId The ID of the job. + * @param disableJobOption Specifies what to do with running tasks associated with the job. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void disableJob(String jobId, DisableJobOption disableJobOption, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobDisableOptions options = new JobDisableOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().jobs().disable(jobId, disableJobOption, options); + } + + /** + * Updates the specified job. + * This method performs a full replace of all updatable properties of the job. For example, if the constraints parameter is null, then the Batch service removes the job's existing constraints and replaces them with the default constraints. + * + * @param jobId The ID of the job. + * @param poolInfo The pool on which the Batch service runs the job's tasks. You may change the pool for a job only when the job is disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. + * @param priority The priority of the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If null, it is set to the default value 0. + * @param constraints The execution constraints for the job. If null, the constraints are cleared. + * @param onAllTasksComplete Specifies an action the Batch service should take when all tasks in the job are in the completed state. + * @param metadata A list of name-value pairs associated with the job as metadata. If null, it takes the default value of an empty list; in effect, any existing metadata is deleted. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void updateJob(String jobId, PoolInformation poolInfo, Integer priority, JobConstraints constraints, OnAllTasksComplete onAllTasksComplete, + List metadata) throws BatchErrorException, IOException { + updateJob(jobId, poolInfo, priority, constraints, onAllTasksComplete, metadata, null); + } + + /** + * Updates the specified job. + * This method performs a full replace of all updatable properties of the job. For example, if the constraints parameter is null, then the Batch service removes the job's existing constraints and replaces them with the default constraints. + * + * @param jobId The ID of the job. + * @param poolInfo The pool on which the Batch service runs the job's tasks. You may change the pool for a job only when the job is disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. + * @param priority The priority of the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If null, it is set to the default value 0. + * @param constraints The execution constraints for the job. If null, the constraints are cleared. + * @param onAllTasksComplete Specifies an action the Batch service should take when all tasks in the job are in the completed state. + * @param metadata A list of name-value pairs associated with the job as metadata. If null, it takes the default value of an empty list; in effect, any existing metadata is deleted. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void updateJob(String jobId, PoolInformation poolInfo, Integer priority, JobConstraints constraints, OnAllTasksComplete onAllTasksComplete, + List metadata, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobUpdateOptions options = new JobUpdateOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + JobUpdateParameter param = new JobUpdateParameter() + .withPriority(priority) + .withPoolInfo(poolInfo) + .withConstraints(constraints) + .withOnAllTasksComplete(onAllTasksComplete) + .withMetadata(metadata); + + this._parentBatchClient.protocolLayer().jobs().update(jobId, param, options); + } + + /** + * Updates the specified job. + * This method only replaces the properties specified with non-null values. + * + * @param jobId The ID of the job. + * @param poolInfo The pool on which the Batch service runs the job's tasks. You may change the pool for a job only when the job is disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. If null, the job continues to run on its current pool. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void patchJob(String jobId, PoolInformation poolInfo) throws BatchErrorException, IOException { + patchJob(jobId, poolInfo, null, null, null, null, null); + } + + /** + * Updates the specified job. + * This method only replaces the properties specified with non-null values. + * + * @param jobId The ID of the job. + * @param onAllTasksComplete Specifies an action the Batch service should take when all tasks in the job are in the completed state. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void patchJob(String jobId, OnAllTasksComplete onAllTasksComplete) throws BatchErrorException, IOException { + patchJob(jobId, null, null, null, onAllTasksComplete, null, null); + } + + /** + * Updates the specified job. + * This method only replaces the properties specified with non-null values. + * + * @param jobId The ID of the job. + * @param poolInfo The pool on which the Batch service runs the job's tasks. You may change the pool for a job only when the job is disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. If null, the job continues to run on its current pool. + * @param priority The priority of the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If null, the priority of the job is left unchanged. + * @param constraints The execution constraints for the job. If null, the existing execution constraints are left unchanged. + * @param onAllTasksComplete Specifies an action the Batch service should take when all tasks in the job are in the completed state. + * @param metadata A list of name-value pairs associated with the job as metadata. If null, the existing job metadata is left unchanged. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void patchJob(String jobId, PoolInformation poolInfo, Integer priority, JobConstraints constraints, OnAllTasksComplete onAllTasksComplete, + List metadata) throws BatchErrorException, IOException { + patchJob(jobId, poolInfo, priority, constraints, onAllTasksComplete, metadata, null); + } + + /** + * Updates the specified job. + * This method only replaces the properties specified with non-null values. + * + * @param jobId The ID of the job. + * @param poolInfo The pool on which the Batch service runs the job's tasks. You may change the pool for a job only when the job is disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. If null, the job continues to run on its current pool. + * @param priority The priority of the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If null, the priority of the job is left unchanged. + * @param constraints The execution constraints for the job. If null, the existing execution constraints are left unchanged. + * @param onAllTasksComplete Specifies an action the Batch service should take when all tasks in the job are in the completed state. + * @param metadata A list of name-value pairs associated with the job as metadata. If null, the existing job metadata is left unchanged. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void patchJob(String jobId, PoolInformation poolInfo, Integer priority, JobConstraints constraints, OnAllTasksComplete onAllTasksComplete, + List metadata, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobPatchParameter param = new JobPatchParameter() + .withPriority(priority) + .withPoolInfo(poolInfo) + .withConstraints(constraints) + .withOnAllTasksComplete(onAllTasksComplete) + .withMetadata(metadata); + + patchJob(jobId, param, additionalBehaviors); + } + + /** + * Updates the specified job. + * This method only replaces the properties specified with non-null values. + * + * @param jobId The ID of the job. + * @param jobPatchParameter The set of changes to be made to a job. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void patchJob(String jobId, JobPatchParameter jobPatchParameter) throws BatchErrorException, IOException { + patchJob(jobId, jobPatchParameter, null); + } + + /** + * Updates the specified job. + * This method only replaces the properties specified with non-null values. + * + * @param jobId The ID of the job. + * @param jobPatchParameter The parameter to update the job. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void patchJob(String jobId, JobPatchParameter jobPatchParameter, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobPatchOptions options = new JobPatchOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().jobs().patch(jobId, jobPatchParameter, options); + } + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @throws BatchErrorException thrown if the request is rejected by server + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + * @return the TaskCounts object if successful. + */ + public TaskCounts getTaskCounts(String jobId) throws BatchErrorException, IOException { + return getTaskCounts(jobId, null); + } + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException thrown if the request is rejected by server + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + * @return the TaskCounts object if successful. + */ + public TaskCounts getTaskCounts(String jobId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobGetTaskCountsOptions options = new JobGetTaskCountsOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().jobs().getTaskCounts(jobId, options); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java new file mode 100644 index 000000000000..9687557e7d25 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java @@ -0,0 +1,437 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.batch.protocol.models.*; + +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +/** + * Performs job schedule-related operations on an Azure Batch account. + */ +public class JobScheduleOperations implements IInheritedBehaviors { + + private Collection _customBehaviors; + + private final BatchClient _parentBatchClient; + + JobScheduleOperations(BatchClient batchClient, Iterable inheritedBehaviors) { + _parentBatchClient = batchClient; + + // inherit from instantiating parent + InternalHelper.InheritClientBehaviorsAndSetPublicProperty(this, inheritedBehaviors); + } + + /** + * Gets a collection of behaviors that modify or customize requests to the Batch service. + * + * @return A collection of {@link BatchClientBehavior} instances. + */ + @Override + public Collection customBehaviors() { + return _customBehaviors; + } + + /** + * Sets a collection of behaviors that modify or customize requests to the Batch service. + * + * @param behaviors The collection of {@link BatchClientBehavior} instances. + * @return The current instance. + */ + @Override + public IInheritedBehaviors withCustomBehaviors(Collection behaviors) { + _customBehaviors = behaviors; + return this; + } + + /** + * Checks whether the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @return True if the specified job schedule exists; otherwise, false. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public boolean existsJobSchedule(String jobScheduleId) throws BatchErrorException, IOException { + return existsJobSchedule(jobScheduleId, null); + } + + /** + * Checks whether the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return True if the specified job schedule exists; otherwise, false. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public boolean existsJobSchedule(String jobScheduleId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobScheduleExistsOptions options = new JobScheduleExistsOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().jobSchedules().exists(jobScheduleId, options); + } + + /** + * Deletes the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteJobSchedule(String jobScheduleId) throws BatchErrorException, IOException { + deleteJobSchedule(jobScheduleId, null); + } + + /** + * Deletes the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void deleteJobSchedule(String jobScheduleId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobScheduleDeleteOptions options = new JobScheduleDeleteOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().jobSchedules().delete(jobScheduleId, options); + } + + /** + * Gets the specified {@link CloudJobSchedule}. + * + * @param jobScheduleId The ID of the job schedule. + * @return A {@link CloudJobSchedule} containing information about the specified Azure Batch job schedule. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public CloudJobSchedule getJobSchedule(String jobScheduleId) throws BatchErrorException, IOException { + return getJobSchedule(jobScheduleId, null, null); + } + + /** + * Gets the specified {@link CloudJobSchedule}. + * + * @param jobScheduleId The ID of the job schedule. + * @param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service. + * @return A {@link CloudJobSchedule} containing information about the specified Azure Batch job schedule. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public CloudJobSchedule getJobSchedule(String jobScheduleId, DetailLevel detailLevel) throws BatchErrorException, IOException { + return getJobSchedule(jobScheduleId, detailLevel, null); + } + + /** + * Gets the specified {@link CloudJobSchedule}. + * + * @param jobScheduleId The ID of the job schedule. + * @param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A {@link CloudJobSchedule} containing information about the specified Azure Batch job schedule. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public CloudJobSchedule getJobSchedule(String jobScheduleId, DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobScheduleGetOptions options = new JobScheduleGetOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().jobSchedules().get(jobScheduleId, options); + } + + /** + * Updates the specified job schedule. + * This method only replaces the properties specified with non-null values. + * + * @param jobScheduleId The ID of the job schedule. + * @param schedule The schedule according to which jobs will be created. If null, any existing schedule is left unchanged. + * @param jobSpecification The details of the jobs to be created on this schedule. Updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. If null, the existing job specification is left unchanged. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void patchJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification) throws BatchErrorException, IOException { + patchJobSchedule(jobScheduleId, schedule, jobSpecification, null, null); + } + + /** + * Updates the specified job schedule. + * This method only replaces the properties specified with non-null values. + * + * @param jobScheduleId The ID of the job schedule. If null, any existing schedule is left unchanged. + * @param schedule The schedule according to which jobs will be created. + * @param jobSpecification The details of the jobs to be created on this schedule. Updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. If null, the existing job specification is left unchanged. + * @param metadata A list of name-value pairs associated with the job schedule as metadata. If null, the existing metadata are left unchanged. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void patchJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, List metadata) throws BatchErrorException, IOException { + patchJobSchedule(jobScheduleId, schedule, jobSpecification, metadata, null); + } + + /** + * Updates the specified job schedule. + * This method only replaces the properties specified with non-null values. + * + * @param jobScheduleId The ID of the job schedule. + * @param schedule The schedule according to which jobs will be created. If null, any existing schedule is left unchanged. + * @param jobSpecification The details of the jobs to be created on this schedule. Updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. If null, the existing job specification is left unchanged. + * @param metadata A list of name-value pairs associated with the job schedule as metadata. If null, the existing metadata are left unchanged. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void patchJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, List metadata, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobSchedulePatchOptions options = new JobSchedulePatchOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + JobSchedulePatchParameter param = new JobSchedulePatchParameter() + .withJobSpecification(jobSpecification) + .withMetadata(metadata) + .withSchedule(schedule); + this._parentBatchClient.protocolLayer().jobSchedules().patch(jobScheduleId, param, options); + } + + /** + * Updates the specified job schedule. + * This method performs a full replace of all the updatable properties of the job schedule. For example, if the schedule parameter is null, then the Batch service removes the job schedule’s existing schedule and replaces it with the default schedule. + * + * @param jobScheduleId The ID of the job schedule. + * @param schedule The schedule according to which jobs will be created. If null, it is equivalent to passing the default schedule: that is, a single job scheduled to run immediately. + * @param jobSpecification The details of the jobs to be created on this schedule. Updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void updateJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification) throws BatchErrorException, IOException { + updateJobSchedule(jobScheduleId, schedule, jobSpecification, null, null); + } + + /** + * Updates the specified job schedule. + * This method performs a full replace of all the updatable properties of the job schedule. For example, if the schedule parameter is null, then the Batch service removes the job schedule’s existing schedule and replaces it with the default schedule. + * + * @param jobScheduleId The ID of the job schedule. + * @param schedule The schedule according to which jobs will be created. If null, it is equivalent to passing the default schedule: that is, a single job scheduled to run immediately. + * @param jobSpecification The details of the jobs to be created on this schedule. Updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. + * @param metadata A list of name-value pairs associated with the job schedule as metadata. If null, it takes the default value of an empty list; in effect, any existing metadata is deleted. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void updateJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, List metadata) throws BatchErrorException, IOException { + updateJobSchedule(jobScheduleId, schedule, jobSpecification, metadata, null); + } + + /** + * Updates the specified job schedule. + * This method performs a full replace of all the updatable properties of the job schedule. For example, if the schedule parameter is null, then the Batch service removes the job schedule’s existing schedule and replaces it with the default schedule. + * + * @param jobScheduleId The ID of the job schedule. + * @param schedule The schedule according to which jobs will be created. If null, it is equivalent to passing the default schedule: that is, a single job scheduled to run immediately. + * @param jobSpecification The details of the jobs to be created on this schedule. Updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. + * @param metadata A list of name-value pairs associated with the job schedule as metadata. If null, it takes the default value of an empty list; in effect, any existing metadata is deleted. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void updateJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, List metadata, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobScheduleUpdateOptions options = new JobScheduleUpdateOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + JobScheduleUpdateParameter param = new JobScheduleUpdateParameter() + .withJobSpecification(jobSpecification) + .withMetadata(metadata) + .withSchedule(schedule); + this._parentBatchClient.protocolLayer().jobSchedules().update(jobScheduleId, param, options); + } + + /** + * Disables the specified job schedule. Disabled schedules do not create new jobs, but may be re-enabled later. + * + * @param jobScheduleId The ID of the job schedule. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void disableJobSchedule(String jobScheduleId) throws BatchErrorException, IOException { + disableJobSchedule(jobScheduleId, null); + } + + /** + * Disables the specified job schedule. Disabled schedules do not create new jobs, but may be re-enabled later. + * + * @param jobScheduleId The ID of the job schedule. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void disableJobSchedule(String jobScheduleId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobScheduleDisableOptions options = new JobScheduleDisableOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().jobSchedules().disable(jobScheduleId, options); + } + + /** + * Enables the specified job schedule, allowing jobs to be created according to its {@link Schedule}. + * + * @param jobScheduleId The ID of the job schedule. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void enableJobSchedule(String jobScheduleId) throws BatchErrorException, IOException { + enableJobSchedule(jobScheduleId, null); + } + + /** + * Enables the specified job schedule, allowing jobs to be created according to its {@link Schedule}. + * + * @param jobScheduleId The ID of the job schedule. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void enableJobSchedule(String jobScheduleId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobScheduleEnableOptions options = new JobScheduleEnableOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().jobSchedules().enable(jobScheduleId, options); + } + + /** + * Terminates the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void terminateJobSchedule(String jobScheduleId) throws BatchErrorException, IOException { + terminateJobSchedule(jobScheduleId, null); + } + + /** + * Terminates the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void terminateJobSchedule(String jobScheduleId, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobScheduleTerminateOptions options = new JobScheduleTerminateOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().jobSchedules().terminate(jobScheduleId, options); + } + + /** + * Adds a job schedule to the Batch account. + * + * @param jobScheduleId A string that uniquely identifies the job schedule within the account. + * @param schedule The schedule according to which jobs will be created. + * @param jobSpecification Details about the jobs to be created on this schedule. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void createJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification) throws BatchErrorException, IOException { + createJobSchedule(jobScheduleId, schedule, jobSpecification, null); + } + + /** + * Adds a job schedule to the Batch account. + * + * @param jobScheduleId A string that uniquely identifies the job schedule within the account. + * @param schedule The schedule according to which jobs will be created. + * @param jobSpecification Details about the jobs to be created on this schedule. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void createJobSchedule(String jobScheduleId, Schedule schedule, JobSpecification jobSpecification, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobScheduleAddParameter param = new JobScheduleAddParameter() + .withJobSpecification(jobSpecification) + .withSchedule(schedule) + .withId(jobScheduleId); + createJobSchedule(param, additionalBehaviors); + } + + /** + * Adds a job schedule to the Batch account. + * + * @param jobSchedule The job schedule to be added. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void createJobSchedule(JobScheduleAddParameter jobSchedule) throws BatchErrorException, IOException { + createJobSchedule(jobSchedule, null); + } + + /** + * Adds a job schedule to the Batch account. + * + * @param jobSchedule The job schedule to be added. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public void createJobSchedule(JobScheduleAddParameter jobSchedule, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobScheduleAddOptions options = new JobScheduleAddOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().jobSchedules().add(jobSchedule, options); + } + + /** + * Lists the {@link CloudJobSchedule job schedules} in the Batch account. + * + * @return A list of {@link CloudJobSchedule} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listJobSchedules() throws BatchErrorException, IOException { + return listJobSchedules(null, null); + } + + /** + * Lists the {@link CloudJobSchedule job schedules} in the Batch account. + * + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @return A list of {@link CloudJobSchedule} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listJobSchedules(DetailLevel detailLevel) throws BatchErrorException, IOException { + return listJobSchedules(detailLevel, null); + } + + /** + * Lists the {@link CloudJobSchedule job schedules} in the Batch account. + * + * @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. + * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. + * @return A list of {@link CloudJobSchedule} objects. + * @throws BatchErrorException Exception thrown when an error response is received from the Batch service. + * @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. + */ + public PagedList listJobSchedules(DetailLevel detailLevel, Iterable additionalBehaviors) throws BatchErrorException, IOException { + JobScheduleListOptions options = new JobScheduleListOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().jobSchedules().list(options); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobSchedulingErrorCodes.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobSchedulingErrorCodes.java new file mode 100644 index 000000000000..112bc0213ee0 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobSchedulingErrorCodes.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +/** + * Contains error codes specific to job scheduling errors. + */ +public final class JobSchedulingErrorCodes +{ + /** + * The Batch service could not create an auto pool to run the job on, because the account + * has reached its quota of compute nodes. + */ + public static final String AutoPoolCreationFailedWithQuotaReached = "AutoPoolCreationFailedWithQuotaReached"; + + /** + * The auto pool specification for the job has one or more application package references which could not be satisfied. + * This occurs if the application ID or version does not exist or is not active, or if the reference did not specify a + * version and there is no default version configured. + */ + public static final String InvalidApplicationPackageReferencesInAutoPool = "InvalidApplicationPackageReferencesInAutoPool"; + + /** + * The auto pool specification for the job has an invalid automatic scaling formula. + */ + public static final String InvalidAutoScaleFormulaInAutoPool = "InvalidAutoScaleFormulaInAutoPool"; + + /** + * The auto pool specification for the job has an invalid certificate reference (for example, to a + * certificate that does not exist). + */ + public static final String InvalidCertificatesInAutoPool = "InvalidCertificatesInAutoPool"; + + /** + * The reason for the scheduling error is unknown. + */ + public static final String Unknown = "Unknown"; +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java new file mode 100644 index 000000000000..b5fc1ccb2e58 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java @@ -0,0 +1,1335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.batch.protocol.models.*; +import org.joda.time.DateTime; +import org.joda.time.Period; + +import java.io.IOException; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; + +/** + * Performs pool-related operations on an Azure Batch account. + */ +public class PoolOperations implements IInheritedBehaviors { + PoolOperations(BatchClient batchClient, Collection customBehaviors) { + _parentBatchClient = batchClient; + + // inherit from instantiating parent + InternalHelper.InheritClientBehaviorsAndSetPublicProperty(this, customBehaviors); + } + + private Collection _customBehaviors; + + private final BatchClient _parentBatchClient; + + /** + * Gets a collection of behaviors that modify or customize requests to the Batch + * service. + * + * @return A collection of {@link BatchClientBehavior} instances. + */ + @Override + public Collection customBehaviors() { + return _customBehaviors; + } + + /** + * Sets a collection of behaviors that modify or customize requests to the Batch + * service. + * + * @param behaviors + * The collection of {@link BatchClientBehavior} instances. + * @return The current instance. + */ + @Override + public IInheritedBehaviors withCustomBehaviors(Collection behaviors) { + _customBehaviors = behaviors; + return this; + } + + /** + * Lists the {@link CloudPool pools} in the Batch account. + * + * @return A list of {@link CloudPool} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public PagedList listPools() throws BatchErrorException, IOException { + return listPools(null, null); + } + + /** + * Lists the {@link CloudPool pools} in the Batch account. + * + * @param detailLevel + * A {@link DetailLevel} used for filtering the list and for + * controlling which properties are retrieved from the service. + * @return A list of {@link CloudPool} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public PagedList listPools(DetailLevel detailLevel) throws BatchErrorException, IOException { + return listPools(detailLevel, null); + } + + /** + * Lists the {@link CloudPool pools} in the Batch account. + * + * @param detailLevel + * A {@link DetailLevel} used for filtering the list and for + * controlling which properties are retrieved from the service. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @return A list of {@link CloudPool} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public PagedList listPools(DetailLevel detailLevel, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + PoolListOptions options = new PoolListOptions(); + + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().pools().list(options); + } + + /** + * Gets the specified {@link CloudPool}. + * + * @param poolId + * The ID of the pool to get. + * @return A {@link CloudPool} containing information about the specified Azure + * Batch pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public CloudPool getPool(String poolId) throws BatchErrorException, IOException { + return getPool(poolId, null, null); + } + + /** + * Gets the specified {@link CloudPool}. + * + * @param poolId + * The ID of the pool to get. + * @param detailLevel + * A {@link DetailLevel} used for controlling which properties are + * retrieved from the service. + * @return A {@link CloudPool} containing information about the specified Azure + * Batch pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public CloudPool getPool(String poolId, DetailLevel detailLevel) throws BatchErrorException, IOException { + return getPool(poolId, detailLevel, null); + } + + /** + * Gets the specified {@link CloudPool}. + * + * @param poolId + * The ID of the pool to get. + * @param detailLevel + * A {@link DetailLevel} used for controlling which properties are + * retrieved from the service. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @return A {@link CloudPool} containing information about the specified Azure + * Batch pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public CloudPool getPool(String poolId, DetailLevel detailLevel, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + PoolGetOptions options = new PoolGetOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().pools().get(poolId, options); + } + + /** + * Deletes the specified pool. + * + * @param poolId + * The ID of the pool to delete. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void deletePool(String poolId) throws BatchErrorException, IOException { + deletePool(poolId, null); + } + + /** + * Deletes the specified pool. + * + * @param poolId + * The ID of the pool to delete. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void deletePool(String poolId, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + PoolDeleteOptions options = new PoolDeleteOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().pools().delete(poolId, options); + } + + /** + * Adds a pool to the Batch account. + * + * @param poolId + * The ID of the pool. + * @param virtualMachineSize + * The size of virtual machines in the pool. See https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/ + * for sizes. + * @param cloudServiceConfiguration + * The {@link CloudServiceConfiguration} for the pool. + * @param targetDedicatedNodes + * The desired number of dedicated compute nodes in the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void createPool(String poolId, String virtualMachineSize, + CloudServiceConfiguration cloudServiceConfiguration, int targetDedicatedNodes) + throws BatchErrorException, IOException { + createPool(poolId, virtualMachineSize, cloudServiceConfiguration, targetDedicatedNodes, 0, null); + } + + /** + * Adds a pool to the Batch account. + * + * @param poolId + * The ID of the pool. + * @param virtualMachineSize + * The size of virtual machines in the pool. See https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/ + * for sizes. + * @param cloudServiceConfiguration + * The {@link CloudServiceConfiguration} for the pool. + * @param targetDedicatedNodes + * The desired number of dedicated compute nodes in the pool. + * @param targetLowPriorityNodes + * The desired number of low-priority compute nodes in the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void createPool(String poolId, String virtualMachineSize, + CloudServiceConfiguration cloudServiceConfiguration, int targetDedicatedNodes, int targetLowPriorityNodes) + throws BatchErrorException, IOException { + createPool(poolId, virtualMachineSize, cloudServiceConfiguration, targetDedicatedNodes, targetLowPriorityNodes, + null); + } + + /** + * Adds a pool to the Batch account. + * + * @param poolId + * The ID of the pool. + * @param virtualMachineSize + * The size of virtual machines in the pool. See https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/ + * for sizes. + * @param cloudServiceConfiguration + * The {@link CloudServiceConfiguration} for the pool. + * @param targetDedicatedNodes + * The desired number of dedicated compute nodes in the pool. + * @param targetLowPriorityNodes + * The desired number of low-priority compute nodes in the pool. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void createPool(String poolId, String virtualMachineSize, + CloudServiceConfiguration cloudServiceConfiguration, int targetDedicatedNodes, int targetLowPriorityNodes, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + PoolAddParameter parameter = new PoolAddParameter().withId(poolId) + .withCloudServiceConfiguration(cloudServiceConfiguration).withTargetDedicatedNodes(targetDedicatedNodes) + .withTargetLowPriorityNodes(targetLowPriorityNodes).withVmSize(virtualMachineSize); + + createPool(parameter, additionalBehaviors); + } + + /** + * Adds a pool to the Batch account. + * + * @param poolId + * The ID of the pool. + * @param virtualMachineSize + * The size of virtual machines in the pool. See https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/ + * for sizes. + * @param virtualMachineConfiguration + * The {@link VirtualMachineConfiguration} for the pool. + * @param targetDedicatedNodes + * The desired number of dedicated compute nodes in the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void createPool(String poolId, String virtualMachineSize, + VirtualMachineConfiguration virtualMachineConfiguration, int targetDedicatedNodes) + throws BatchErrorException, IOException { + createPool(poolId, virtualMachineSize, virtualMachineConfiguration, targetDedicatedNodes, 0, null); + } + + /** + * Adds a pool to the Batch account. + * + * @param poolId + * The ID of the pool. + * @param virtualMachineSize + * The size of virtual machines in the pool. See https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/ + * for sizes. + * @param virtualMachineConfiguration + * The {@link VirtualMachineConfiguration} for the pool. + * @param targetDedicatedNodes + * The desired number of dedicated compute nodes in the pool. + * @param targetLowPriorityNodes + * The desired number of low-priority compute nodes in the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void createPool(String poolId, String virtualMachineSize, + VirtualMachineConfiguration virtualMachineConfiguration, int targetDedicatedNodes, + int targetLowPriorityNodes) throws BatchErrorException, IOException { + createPool(poolId, virtualMachineSize, virtualMachineConfiguration, targetDedicatedNodes, + targetLowPriorityNodes, null); + } + + /** + * Adds a pool to the Batch account. + * + * @param poolId + * The ID of the pool. + * @param virtualMachineSize + * The size of virtual machines in the pool. See https://azure.microsoft.com/documentation/articles/virtual-machines-size-specs/ + * for sizes. + * @param virtualMachineConfiguration + * The {@link VirtualMachineConfiguration} for the pool. + * @param targetDedicatedNodes + * The desired number of dedicated compute nodes in the pool. + * @param targetLowPriorityNodes + * The desired number of low-priority compute nodes in the pool. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void createPool(String poolId, String virtualMachineSize, + VirtualMachineConfiguration virtualMachineConfiguration, int targetDedicatedNodes, + int targetLowPriorityNodes, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + PoolAddParameter parameter = new PoolAddParameter().withId(poolId) + .withVirtualMachineConfiguration(virtualMachineConfiguration) + .withTargetDedicatedNodes(targetDedicatedNodes).withTargetLowPriorityNodes(targetLowPriorityNodes) + .withVmSize(virtualMachineSize); + + createPool(parameter, additionalBehaviors); + } + + /** + * Adds a pool to the Batch account. + * + * @param pool + * The pool to be added. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void createPool(PoolAddParameter pool) throws BatchErrorException, IOException { + createPool(pool, null); + } + + /** + * Adds a pool to the Batch account. + * + * @param pool + * The pool to be added. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void createPool(PoolAddParameter pool, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + PoolAddOptions options = new PoolAddOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().pools().add(pool, options); + } + + /** + * Resizes the specified pool. + * + * @param poolId + * The ID of the pool. + * @param targetDedicatedNodes + * The desired number of dedicated compute nodes in the pool. + * @param targetLowPriorityNodes + * The desired number of low-priority compute nodes in the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void resizePool(String poolId, Integer targetDedicatedNodes, Integer targetLowPriorityNodes) + throws BatchErrorException, IOException { + resizePool(poolId, targetDedicatedNodes, targetLowPriorityNodes, null, null, null); + } + + /** + * Resizes the specified pool. + * + * @param poolId + * The ID of the pool. + * @param targetDedicatedNodes + * The desired number of dedicated compute nodes in the pool. + * @param targetLowPriorityNodes + * The desired number of low-priority compute nodes in the pool. + * @param resizeTimeout + * The timeout for allocation of compute nodes to the pool or removal + * of compute nodes from the pool. If the pool has not reached the + * target size after this time, the resize is stopped. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void resizePool(String poolId, Integer targetDedicatedNodes, Integer targetLowPriorityNodes, + Period resizeTimeout) throws BatchErrorException, IOException { + resizePool(poolId, targetDedicatedNodes, targetLowPriorityNodes, resizeTimeout, null, null); + } + + /** + * Resizes the specified pool. + * + * @param poolId + * The ID of the pool. + * @param targetDedicatedNodes + * The desired number of dedicated compute nodes in the pool. + * @param targetLowPriorityNodes + * The desired number of low-priority compute nodes in the pool. + * @param resizeTimeout + * The timeout for allocation of compute nodes to the pool or removal + * of compute nodes from the pool. If the pool has not reached the + * target size after this time, the resize is stopped. + * @param deallocationOption + * Specifies when nodes may be removed from the pool, if the pool + * size is decreasing. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void resizePool(String poolId, Integer targetDedicatedNodes, Integer targetLowPriorityNodes, + Period resizeTimeout, ComputeNodeDeallocationOption deallocationOption) + throws BatchErrorException, IOException { + resizePool(poolId, targetDedicatedNodes, targetLowPriorityNodes, resizeTimeout, deallocationOption, null); + } + + /** + * Resizes the specified pool. + * + * @param poolId + * The ID of the pool. + * @param targetDedicatedNodes + * The desired number of dedicated compute nodes in the pool. + * @param targetLowPriorityNodes + * The desired number of low-priority compute nodes in the pool. + * @param resizeTimeout + * The timeout for allocation of compute nodes to the pool or removal + * of compute nodes from the pool. If the pool has not reached the + * target size after this time, the resize is stopped. + * @param deallocationOption + * Specifies when nodes may be removed from the pool, if the pool + * size is decreasing. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void resizePool(String poolId, Integer targetDedicatedNodes, Integer targetLowPriorityNodes, + Period resizeTimeout, ComputeNodeDeallocationOption deallocationOption, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + PoolResizeOptions options = new PoolResizeOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + PoolResizeParameter param = new PoolResizeParameter().withResizeTimeout(resizeTimeout) + .withNodeDeallocationOption(deallocationOption).withTargetDedicatedNodes(targetDedicatedNodes) + .withTargetLowPriorityNodes(targetLowPriorityNodes); + + this._parentBatchClient.protocolLayer().pools().resize(poolId, param, options); + } + + /** + * Stops a pool resize operation. + * + * @param poolId + * The ID of the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void stopResizePool(String poolId) throws BatchErrorException, IOException { + stopResizePool(poolId, null); + } + + /** + * Stops a pool resize operation. + * + * @param poolId + * The ID of the pool. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void stopResizePool(String poolId, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + PoolStopResizeOptions options = new PoolStopResizeOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().pools().stopResize(poolId, options); + } + + /** + * Enables automatic scaling on the specified pool. + * + * @param poolId + * The ID of the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void enableAutoScale(String poolId) throws BatchErrorException, IOException { + enableAutoScale(poolId, null, null, null); + } + + /** + * Enables automatic scaling on the specified pool. + * + * @param poolId + * The ID of the pool. + * @param autoScaleFormula + * The formula for the desired number of compute nodes in the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void enableAutoScale(String poolId, String autoScaleFormula) throws BatchErrorException, IOException { + enableAutoScale(poolId, autoScaleFormula, null, null); + } + + /** + * Enables automatic scaling on the specified pool. + * + * @param poolId + * The ID of the pool. + * @param autoScaleFormula + * The formula for the desired number of compute nodes in the pool. + * @param autoScaleEvaluationInterval + * The time interval at which to automatically adjust the pool size. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void enableAutoScale(String poolId, String autoScaleFormula, Period autoScaleEvaluationInterval) + throws BatchErrorException, IOException { + enableAutoScale(poolId, autoScaleFormula, autoScaleEvaluationInterval, null); + } + + /** + * Enables automatic scaling on the specified pool. + * + * @param poolId + * The ID of the pool. + * @param autoScaleFormula + * The formula for the desired number of compute nodes in the pool. + * @param autoScaleEvaluationInterval + * The time interval at which to automatically adjust the pool size. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void enableAutoScale(String poolId, String autoScaleFormula, Period autoScaleEvaluationInterval, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + PoolEnableAutoScaleOptions options = new PoolEnableAutoScaleOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + PoolEnableAutoScaleParameter param = new PoolEnableAutoScaleParameter().withAutoScaleFormula(autoScaleFormula) + .withAutoScaleEvaluationInterval(autoScaleEvaluationInterval); + + this._parentBatchClient.protocolLayer().pools().enableAutoScale(poolId, param, options); + } + + /** + * Disables automatic scaling on the specified pool. + * + * @param poolId + * The ID of the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void disableAutoScale(String poolId) throws BatchErrorException, IOException { + disableAutoScale(poolId, null); + } + + /** + * Disables automatic scaling on the specified pool. + * + * @param poolId + * The ID of the pool. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void disableAutoScale(String poolId, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + PoolDisableAutoScaleOptions options = new PoolDisableAutoScaleOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().pools().disableAutoScale(poolId, options); + } + + /** + * Gets the result of evaluating an automatic scaling formula on the specified + * pool. This is primarily for validating an autoscale formula, as it simply + * returns the result without applying the formula to the pool. + * + * @param poolId + * The ID of the pool. + * @param autoScaleFormula + * The formula to be evaluated on the pool. + * @return The result of evaluating the formula on the specified pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public AutoScaleRun evaluateAutoScale(String poolId, String autoScaleFormula) + throws BatchErrorException, IOException { + return evaluateAutoScale(poolId, autoScaleFormula, null); + } + + /** + * Gets the result of evaluating an automatic scaling formula on the specified + * pool. This is primarily for validating an autoscale formula, as it simply + * returns the result without applying the formula to the pool. + * + * @param poolId + * The ID of the pool. + * @param autoScaleFormula + * The formula to be evaluated on the pool. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @return The result of evaluating the formula on the specified pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public AutoScaleRun evaluateAutoScale(String poolId, String autoScaleFormula, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + PoolEvaluateAutoScaleOptions options = new PoolEvaluateAutoScaleOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().pools().evaluateAutoScale(poolId, autoScaleFormula, options); + } + + /** + * Removes the specified compute node from the specified pool. + * + * @param poolId + * The ID of the pool. + * @param computeNodeId + * The ID of the compute node to remove from the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void removeNodeFromPool(String poolId, String computeNodeId) throws BatchErrorException, IOException { + removeNodeFromPool(poolId, computeNodeId, null, null, null); + } + + /** + * Removes the specified compute node from the specified pool. + * + * @param poolId + * The ID of the pool. + * @param computeNodeId + * The ID of the compute node to remove from the pool. + * @param deallocationOption + * Specifies when nodes may be removed from the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void removeNodeFromPool(String poolId, String computeNodeId, + ComputeNodeDeallocationOption deallocationOption) throws BatchErrorException, IOException { + removeNodeFromPool(poolId, computeNodeId, deallocationOption, null, null); + } + + /** + * Removes the specified compute node from the specified pool. + * + * @param poolId + * The ID of the pool. + * @param computeNodeId + * The ID of the compute node to remove from the pool. + * @param deallocationOption + * Specifies when nodes may be removed from the pool. + * @param resizeTimeout + * Specifies the timeout for removal of compute nodes from the pool. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void removeNodeFromPool(String poolId, String computeNodeId, + ComputeNodeDeallocationOption deallocationOption, Period resizeTimeout, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + List nodeIds = new LinkedList<>(); + nodeIds.add(computeNodeId); + + removeNodesFromPool(poolId, nodeIds, deallocationOption, resizeTimeout, additionalBehaviors); + } + + /** + * Removes the specified compute nodes from the specified pool. + * + * @param poolId + * The ID of the pool. + * @param computeNodes + * The compute nodes to remove from the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void removeNodesFromPool(String poolId, Collection computeNodes) + throws BatchErrorException, IOException { + removeNodesFromPool(poolId, computeNodes, null, null, null); + } + + /** + * Removes the specified compute nodes from the specified pool. + * + * @param poolId + * The ID of the pool. + * @param computeNodes + * The compute nodes to remove from the pool. + * @param deallocationOption + * Specifies when nodes may be removed from the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void removeNodesFromPool(String poolId, Collection computeNodes, + ComputeNodeDeallocationOption deallocationOption) throws BatchErrorException, IOException { + removeNodesFromPool(poolId, computeNodes, deallocationOption, null, null); + } + + /** + * Removes the specified compute nodes from the specified pool. + * + * @param poolId + * The ID of the pool. + * @param computeNodes + * The compute nodes to remove from the pool. + * @param deallocationOption + * Specifies when nodes may be removed from the pool. + * @param resizeTimeout + * Specifies the timeout for removal of compute nodes from the pool. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void removeNodesFromPool(String poolId, Collection computeNodes, + ComputeNodeDeallocationOption deallocationOption, Period resizeTimeout, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + List nodeIds = new LinkedList<>(); + for (ComputeNode node : computeNodes) { + nodeIds.add(node.id()); + } + + removeNodesFromPool(poolId, nodeIds, deallocationOption, resizeTimeout, additionalBehaviors); + } + + /** + * Removes the specified compute nodes from the specified pool. + * + * @param poolId + * The ID of the pool. + * @param computeNodeIds + * The IDs of the compute nodes to remove from the pool. + * @param deallocationOption + * Specifies when nodes may be removed from the pool. + * @param resizeTimeout + * Specifies the timeout for removal of compute nodes from the pool. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void removeNodesFromPool(String poolId, List computeNodeIds, + ComputeNodeDeallocationOption deallocationOption, Period resizeTimeout, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + PoolRemoveNodesOptions options = new PoolRemoveNodesOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + NodeRemoveParameter param = new NodeRemoveParameter().withNodeList(computeNodeIds) + .withNodeDeallocationOption(deallocationOption).withResizeTimeout(resizeTimeout); + + this._parentBatchClient.protocolLayer().pools().removeNodes(poolId, param, options); + } + + /** + * Checks whether the specified pool exists. + * + * @param poolId + * The ID of the pool. + * @return True if the pool exists; otherwise, false. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public boolean existsPool(String poolId) throws BatchErrorException, IOException { + return existsPool(poolId, null); + } + + /** + * Checks whether the specified pool exists. + * + * @param poolId + * The ID of the pool. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @return True if the pool exists; otherwise, false. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public boolean existsPool(String poolId, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + + PoolExistsOptions options = new PoolExistsOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().pools().exists(poolId, options); + } + + /** + * Updates the specified pool. This method fully replaces all the updatable + * properties of the pool. For example, if the startTask parameter is null and + * the pool has a start task associated with it, then the Batch service will + * remove the existing start task. + * + * @param poolId + * The ID of the pool. + * @param startTask + * A task to run on each compute node as it joins the pool. If null, + * any existing start task is removed from the pool. + * @param certificateReferences + * A collection of certificates to be installed on each compute node + * in the pool. If null, any existing certificate references are + * removed from the pool. + * @param applicationPackageReferences + * A collection of application packages to be installed on each + * compute node in the pool. If null, any existing application + * packages references are removed from the pool. + * @param metadata + * A collection of name-value pairs associated with the pool as + * metadata. If null, any existing metadata is removed from the pool. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void updatePoolProperties(String poolId, StartTask startTask, + Collection certificateReferences, + Collection applicationPackageReferences, Collection metadata) + throws BatchErrorException, IOException { + updatePoolProperties(poolId, startTask, certificateReferences, applicationPackageReferences, metadata, null); + } + + /** + * Updates the specified pool. This method fully replaces all the updatable + * properties of the pool. For example, if the startTask parameter is null and + * the pool has a start task associated with it, then the Batch service will + * remove the existing start task. + * + * @param poolId + * The ID of the pool. + * @param startTask + * A task to run on each compute node as it joins the pool. If null, + * any existing start task is removed from the pool. + * @param certificateReferences + * A collection of certificates to be installed on each compute node + * in the pool. If null, any existing certificate references are + * removed from the pool. + * @param applicationPackageReferences + * A collection of application packages to be installed on each + * compute node in the pool. If null, any existing application + * packages references are removed from the pool. + * @param metadata + * A collection of name-value pairs associated with the pool as + * metadata. If null, any existing metadata is removed from the pool. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void updatePoolProperties(String poolId, StartTask startTask, + Collection certificateReferences, + Collection applicationPackageReferences, Collection metadata, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + PoolUpdatePropertiesOptions options = new PoolUpdatePropertiesOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + PoolUpdatePropertiesParameter param = new PoolUpdatePropertiesParameter() + .withMetadata(metadata == null ? new LinkedList() : new LinkedList<>(metadata)) + .withApplicationPackageReferences( + applicationPackageReferences == null ? new LinkedList() + : new LinkedList<>(applicationPackageReferences)) + .withCertificateReferences(certificateReferences == null ? new LinkedList() + : new LinkedList<>(certificateReferences)) + .withStartTask(startTask); + + this._parentBatchClient.protocolLayer().pools().updateProperties(poolId, param, options); + } + + /** + * Updates the specified pool. This method only replaces the properties + * specified with non-null values. + * + * @param poolId + * The ID of the pool. + * @param startTask + * A task to run on each compute node as it joins the pool. If null, + * any existing start task is left unchanged. + * @param certificateReferences + * A collection of certificates to be installed on each compute node + * in the pool. If null, any existing certificate references are left + * unchanged. + * @param applicationPackageReferences + * A collection of application packages to be installed on each + * compute node in the pool. If null, any existing application + * packages references are left unchanged. + * @param metadata + * A collection of name-value pairs associated with the pool as + * metadata. If null, any existing metadata is left unchanged. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void patchPool(String poolId, StartTask startTask, Collection certificateReferences, + Collection applicationPackageReferences, Collection metadata) + throws BatchErrorException, IOException { + patchPool(poolId, startTask, certificateReferences, applicationPackageReferences, metadata, null); + } + + /** + * Updates the specified pool. This method only replaces the properties + * specified with non-null values. + * + * @param poolId + * The ID of the pool. + * @param startTask + * A task to run on each compute node as it joins the pool. If null, + * any existing start task is left unchanged. + * @param certificateReferences + * A collection of certificates to be installed on each compute node + * in the pool. If null, any existing certificate references are left + * unchanged. + * @param applicationPackageReferences + * A collection of application packages to be installed on each + * compute node in the pool. If null, any existing application + * packages references are left unchanged. + * @param metadata + * A collection of name-value pairs associated with the pool as + * metadata. If null, any existing metadata is left unchanged. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void patchPool(String poolId, StartTask startTask, Collection certificateReferences, + Collection applicationPackageReferences, Collection metadata, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + PoolPatchOptions options = new PoolPatchOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + PoolPatchParameter param = new PoolPatchParameter().withStartTask(startTask); + if (metadata != null) { + param.withMetadata(new LinkedList<>(metadata)); + } + if (applicationPackageReferences != null) { + param.withApplicationPackageReferences(new LinkedList<>(applicationPackageReferences)); + } + if (certificateReferences != null) { + param.withCertificateReferences(new LinkedList<>(certificateReferences)); + } + + this._parentBatchClient.protocolLayer().pools().patch(poolId, param, options); + } + + /** + * Lists pool usage metrics. + * + * @param startTime + * The start time of the aggregation interval covered by this entry. + * @param endTime + * The end time of the aggregation interval for this entry. + * @return A list of {@link PoolUsageMetrics} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public PagedList listPoolUsageMetrics(DateTime startTime, DateTime endTime) + throws BatchErrorException, IOException { + return listPoolUsageMetrics(startTime, endTime, null, null); + } + + /** + * Lists pool usage metrics. + * + * @param startTime + * The start time of the aggregation interval covered by this entry. + * @param endTime + * The end time of the aggregation interval for this entry. + * @param detailLevel + * A {@link DetailLevel} used for filtering the list and for + * controlling which properties are retrieved from the service. + * @return A list of {@link PoolUsageMetrics} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public PagedList listPoolUsageMetrics(DateTime startTime, DateTime endTime, + DetailLevel detailLevel) throws BatchErrorException, IOException { + return listPoolUsageMetrics(startTime, endTime, detailLevel, null); + } + + /** + * Lists pool usage metrics. + * + * @param startTime + * The start time of the aggregation interval covered by this entry. + * @param endTime + * The end time of the aggregation interval for this entry. + * @param detailLevel + * A {@link DetailLevel} used for filtering the list and for + * controlling which properties are retrieved from the service. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @return A list of {@link PoolUsageMetrics} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public PagedList listPoolUsageMetrics(DateTime startTime, DateTime endTime, + DetailLevel detailLevel, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + PoolListUsageMetricsOptions options = new PoolListUsageMetricsOptions().withStartTime(startTime) + .withEndTime(endTime); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().pools().listUsageMetrics(options); + } + + /** + * Gets lifetime summary statistics for all of the pools in the current account. + * Statistics are aggregated across all pools that have ever existed in the + * account, from account creation to the last update time of the statistics. + * + * @return The aggregated pool statistics. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public PoolStatistics getAllPoolsLifetimeStatistics() throws BatchErrorException, IOException { + return getAllPoolsLifetimeStatistics(null); + } + + /** + * Gets lifetime summary statistics for all of the pools in the current account. + * Statistics are aggregated across all pools that have ever existed in the + * account, from account creation to the last update time of the statistics. + * + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @return The aggregated pool statistics. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public PoolStatistics getAllPoolsLifetimeStatistics(Iterable additionalBehaviors) + throws BatchErrorException, IOException { + PoolGetAllLifetimeStatisticsOptions options = new PoolGetAllLifetimeStatisticsOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().pools().getAllLifetimeStatistics(options); + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolResizeErrorCodes.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolResizeErrorCodes.java new file mode 100644 index 000000000000..a3c8d5c8b115 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolResizeErrorCodes.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +/** + * Contains error codes specific to pool resize errors. + */ +public final class PoolResizeErrorCodes +{ + /** + * The account has reached its quota of compute nodes. + */ + public static final String AccountCoreQuotaReached = "AccountCoreQuotaReached"; + + /** + * An error occurred while trying to allocate the desired number of compute nodes. + */ + public static final String AllocationFailed = "AllocationFailed"; + + /** + * The Batch service was unable to allocate the desired number of compute nodes within the resize timeout. + */ + public static final String AllocationTimedOut= "AllocationTimedout"; + + /** + * An error occurred when removing compute nodes from the pool. + */ + public static final String RemoveNodesFailed = "RemoveNodesFailed"; + + /** + * The user stopped the resize operation. + */ + public static final String ResizeStopped = "ResizeStopped"; + + /** + * The reason for the failure is not known. + */ + public static final String Unknown = "Unknown"; +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskFailureInformationCodes.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskFailureInformationCodes.java new file mode 100644 index 000000000000..8666f16bd0eb --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskFailureInformationCodes.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +/** + * Contains error codes specific to task failure information. + */ +public final class TaskFailureInformationCodes +{ + /** + * An error occurred when trying to deploy a required application package. + */ + public static final String ApplicationPackageError = "ApplicationPackageError"; + + /** + * Access was denied when trying to download a resource file required for the task. + */ + public static final String BlobAccessDenied = "BlobAccessDenied"; + + /** + * An error occurred when trying to download a resource file required for the task. + */ + public static final String BlobDownloadMiscError = "BlobDownloadMiscError"; + + /** + * A timeout occurred when downloading a resource file required for the task. + */ + public static final String BlobDownloadTimedOut = "BlobDownloadTimedOut"; + + /** + * A resource file required for the task does not exist. + */ + public static final String BlobNotFound = "BlobNotFound"; + + /** + * An error occurred when launching the task's command line. + */ + public static final String CommandLaunchFailed = "CommandLaunchFailed"; + + /** + * The program specified in the task's command line was not found. + */ + public static final String CommandProgramNotFound = "CommandProgramNotFound"; + + /** + * The compute node disk ran out of space when downloading the resource files required for the task. + */ + public static final String DiskFull = "DiskFull"; + + /** + * The compute node could not create a directory for the task's resource files. + */ + public static final String ResourceDirectoryCreateFailed = "ResourceDirectoryCreateFailed"; + + /** + * The compute node could not create a local file when trying to download a resource file required for the task. + */ + public static final String ResourceFileCreateFailed = "ResourceFileCreateFailed"; + + /** + * The compute node could not write to a local file when trying to download a resource file required for the task. + */ + public static final String ResourceFileWriteFailed = "ResourceFileWriteFailed"; + + /** + * The task ended. + */ + public static final String TaskEnded = "TaskEnded"; + + /** + * The reason for the scheduling error is unknown. + */ + public static final String Unknown = "Unknown"; + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java new file mode 100644 index 000000000000..eeac6390e5a8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java @@ -0,0 +1,785 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.batch.interceptor.BatchClientParallelOptions; +import com.microsoft.azure.batch.protocol.models.*; + +import java.io.IOException; +import java.util.*; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * Performs task-related operations on an Azure Batch account. + */ +public class TaskOperations implements IInheritedBehaviors { + TaskOperations(BatchClient batchClient, Collection customBehaviors) { + _parentBatchClient = batchClient; + + // inherit from instantiating parent + InternalHelper.InheritClientBehaviorsAndSetPublicProperty(this, customBehaviors); + } + + private Collection _customBehaviors; + + private final BatchClient _parentBatchClient; + + /** + * Gets a collection of behaviors that modify or customize requests to the Batch + * service. + * + * @return A collection of {@link BatchClientBehavior} instances. + */ + @Override + public Collection customBehaviors() { + return _customBehaviors; + } + + /** + * Sets a collection of behaviors that modify or customize requests to the Batch + * service. + * + * @param behaviors + * The collection of {@link BatchClientBehavior} instances. + * @return The current instance. + */ + @Override + public IInheritedBehaviors withCustomBehaviors(Collection behaviors) { + _customBehaviors = behaviors; + return this; + } + + /** + * Adds a single task to a job. + * + * @param jobId + * The ID of the job to which to add the task. + * @param taskToAdd + * The {@link TaskAddParameter task} to add. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void createTask(String jobId, TaskAddParameter taskToAdd) throws BatchErrorException, IOException { + createTask(jobId, taskToAdd, null); + } + + /** + * Adds a single task to a job. + * + * @param jobId + * The ID of the job to which to add the task. + * @param taskToAdd + * The {@link TaskAddParameter task} to add. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void createTask(String jobId, TaskAddParameter taskToAdd, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + TaskAddOptions options = new TaskAddOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().tasks().add(jobId, taskToAdd, options); + } + + /** + * Adds multiple tasks to a job. + * + * @param jobId + * The ID of the job to which to add the task. + * @param taskList + * A list of {@link TaskAddParameter tasks} to add. + * @throws RuntimeException + * Exception thrown when an error response is received from the + * Batch service or any network exception. + * @throws InterruptedException + * Exception thrown if any thread has interrupted the current + * thread. + */ + public void createTasks(String jobId, List taskList) + throws RuntimeException, InterruptedException { + createTasks(jobId, taskList, null); + } + + private static class WorkingThread implements Runnable { + final static int MAX_TASKS_PER_REQUEST = 100; + private static final AtomicInteger currentMaxTasks = new AtomicInteger(MAX_TASKS_PER_REQUEST); + + BatchClient client; + BehaviorManager bhMgr; + String jobId; + Queue pendingList; + List failures; + volatile Exception exception; + final Object lock; + + WorkingThread(BatchClient client, BehaviorManager bhMgr, String jobId, Queue pendingList, + List failures, Object lock) { + this.client = client; + this.bhMgr = bhMgr; + this.jobId = jobId; + this.pendingList = pendingList; + this.failures = failures; + this.exception = null; + this.lock = lock; + } + + public Exception getException() { + return this.exception; + } + + /** + * Submits one chunk of tasks to a job. + * + * @param taskList + * A list of {@link TaskAddParameter tasks} to add. + */ + private void submit_chunk(List taskList) { + // The option should be different to every server calls (for example, + // client-request-id) + TaskAddCollectionOptions options = new TaskAddCollectionOptions(); + this.bhMgr.applyRequestBehaviors(options); + try { + TaskAddCollectionResult response = this.client.protocolLayer().tasks().addCollection(this.jobId, + taskList, options); + + if (response != null && response.value() != null) { + for (TaskAddResult result : response.value()) { + if (result.error() != null) { + if (result.status() == TaskAddStatus.SERVER_ERROR) { + // Server error will be retried + for (TaskAddParameter addParameter : taskList) { + if (addParameter.id().equals(result.taskId())) { + pendingList.add(addParameter); + break; + } + } + } else if (result.status() == TaskAddStatus.CLIENT_ERROR + && !result.error().code().equals(BatchErrorCodeStrings.TaskExists)) { + // Client error will be recorded + failures.add(result); + } + } + } + } + } catch (BatchErrorException e) { + // If we get RequestBodyTooLarge could be that we chunked the tasks too large. + // Try decreasing the size unless caused by 1 task. + if (e.body().code().equals(BatchErrorCodeStrings.RequestBodyTooLarge) && taskList.size() > 1) { + // Use binary reduction to decrease size of submitted chunks + int midpoint = taskList.size() / 2; + // If the midpoint is less than the currentMaxTasks used to create new chunks, + // attempt to atomically reduce currentMaxTasks. + // In the case where compareAndSet fails, that means that currentMaxTasks which + // was the goal + int max = currentMaxTasks.get(); + while (midpoint < max) { + currentMaxTasks.compareAndSet(max, midpoint); + max = currentMaxTasks.get(); + } + // Resubmit chunk as a smaller list and requeue remaining tasks. + pendingList.addAll(taskList.subList(midpoint, taskList.size())); + submit_chunk(taskList.subList(0, midpoint)); + } else { + // Any exception will stop further call + exception = e; + pendingList.addAll(taskList); + } + } catch (RuntimeException e) { + // Any exception will stop further call + exception = e; + pendingList.addAll(taskList); + } + } + + @Override + public void run() { + try { + List taskList = new LinkedList<>(); + + // Take the task from the queue up to MAX_TASKS_PER_REQUEST + int count = 0; + int maxAmount = currentMaxTasks.get(); + while (count < maxAmount) { + TaskAddParameter param = pendingList.poll(); + if (param != null) { + taskList.add(param); + count++; + } else { + break; + } + } + + if (taskList.size() > 0) { + submit_chunk(taskList); + } + } finally { + synchronized (lock) { + // Notify main thread that sub thread finished + lock.notify(); + } + } + } + } + + /** + * Adds multiple tasks to a job. + * + * @param jobId + * The ID of the job to which to add the task. + * @param taskList + * A list of {@link TaskAddParameter tasks} to add. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws RuntimeException + * Exception thrown when an error response is received from the + * Batch service or any network exception. + * @throws InterruptedException + * Exception thrown if any thread has interrupted the current + * thread. + */ + public void createTasks(String jobId, List taskList, + Iterable additionalBehaviors) throws RuntimeException, InterruptedException { + + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + + // Default thread number is 1 + int threadNumber = 1; + + // Get user defined thread number + for (BatchClientBehavior op : bhMgr.getMasterListOfBehaviors()) { + if (op instanceof BatchClientParallelOptions) { + threadNumber = ((BatchClientParallelOptions) op).maxDegreeOfParallelism(); + } + } + + final Object lock = new Object(); + ConcurrentLinkedQueue pendingList = new ConcurrentLinkedQueue<>(taskList); + CopyOnWriteArrayList failures = new CopyOnWriteArrayList<>(); + + Map threads = new HashMap<>(); + Exception innerException = null; + + synchronized (lock) { + while (!pendingList.isEmpty()) { + + if (threads.size() < threadNumber) { + // Kick as many as possible add tasks requests by max allowed threads + WorkingThread worker = new WorkingThread(this._parentBatchClient, bhMgr, jobId, pendingList, + failures, lock); + Thread thread = new Thread(worker); + thread.start(); + threads.put(thread, worker); + } else { + // Wait for any thread to finish + lock.wait(); + + List finishedThreads = new ArrayList<>(); + for (Thread t : threads.keySet()) { + if (t.getState() == Thread.State.TERMINATED) { + finishedThreads.add(t); + // If any exception is encountered, then stop immediately without waiting for + // remaining active threads. + innerException = threads.get(t).getException(); + if (innerException != null) { + break; + } + } + } + + // Free the thread pool so we can start more threads to send the remaining add + // tasks requests. + threads.keySet().removeAll(finishedThreads); + + // Any errors happened, we stop. + if (innerException != null || !failures.isEmpty()) { + break; + } + } + } + } + + // Wait for all remaining threads to finish. + for (Thread t : threads.keySet()) { + t.join(); + } + + if (innerException == null) { + // Check for errors in any of the threads. + for (Thread t : threads.keySet()) { + innerException = threads.get(t).getException(); + if (innerException != null) { + break; + } + } + } + + if (innerException != null) { + // If an exception happened in any of the threads, throw it. + if (innerException instanceof BatchErrorException) { + throw (BatchErrorException) innerException; + } else { + // WorkingThread will only catch and store a BatchErrorException or a + // RuntimeException in its run() method. + // WorkingThread.getException() should therefore only return one of these two + // types, making the cast safe. + throw (RuntimeException) innerException; + } + } + + if (!failures.isEmpty()) { + // Report any client error with leftover request + List notFinished = new ArrayList<>(); + for (TaskAddParameter param : pendingList) { + notFinished.add(param); + } + throw new CreateTasksErrorException("At least one task failed to be added.", failures, notFinished); + } + + // We succeed here + } + + /** + * Lists the {@link CloudTask tasks} of the specified job. + * + * @param jobId + * The ID of the job. + * @return A list of {@link CloudTask} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public PagedList listTasks(String jobId) throws BatchErrorException, IOException { + return listTasks(jobId, null, null); + } + + /** + * Lists the {@link CloudTask tasks} of the specified job. + * + * @param jobId + * The ID of the job. + * @param detailLevel + * A {@link DetailLevel} used for filtering the list and for + * controlling which properties are retrieved from the service. + * @return A list of {@link CloudTask} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public PagedList listTasks(String jobId, DetailLevel detailLevel) + throws BatchErrorException, IOException { + return listTasks(jobId, detailLevel, null); + } + + /** + * Lists the {@link CloudTask tasks} of the specified job. + * + * @param jobId + * The ID of the job. + * @param detailLevel + * A {@link DetailLevel} used for filtering the list and for + * controlling which properties are retrieved from the service. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @return A list of {@link CloudTask} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public PagedList listTasks(String jobId, DetailLevel detailLevel, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + TaskListOptions options = new TaskListOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().tasks().list(jobId, options); + } + + /** + * Lists the {@link SubtaskInformation subtasks} of the specified task. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @return A list of {@link SubtaskInformation} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public List listSubtasks(String jobId, String taskId) throws BatchErrorException, IOException { + return listSubtasks(jobId, taskId, null, null); + } + + /** + * Lists the {@link SubtaskInformation subtasks} of the specified task. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @param detailLevel + * A {@link DetailLevel} used for controlling which properties are + * retrieved from the service. + * @return A list of {@link SubtaskInformation} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public List listSubtasks(String jobId, String taskId, DetailLevel detailLevel) + throws BatchErrorException, IOException { + return listSubtasks(jobId, taskId, detailLevel, null); + } + + /** + * Lists the {@link SubtaskInformation subtasks} of the specified task. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @param detailLevel + * A {@link DetailLevel} used for controlling which properties are + * retrieved from the service. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @return A list of {@link SubtaskInformation} objects. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public List listSubtasks(String jobId, String taskId, DetailLevel detailLevel, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + TaskListSubtasksOptions options = new TaskListSubtasksOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + CloudTaskListSubtasksResult response = this._parentBatchClient.protocolLayer().tasks().listSubtasks(jobId, + taskId, options); + + if (response != null) { + return response.value(); + } else { + return null; + } + } + + /** + * Deletes the specified task. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void deleteTask(String jobId, String taskId) throws BatchErrorException, IOException { + deleteTask(jobId, taskId, null); + } + + /** + * Deletes the specified task. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void deleteTask(String jobId, String taskId, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + TaskDeleteOptions options = new TaskDeleteOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().tasks().delete(jobId, taskId, options); + } + + /** + * Gets the specified {@link CloudTask}. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @return A {@link CloudTask} containing information about the specified Azure + * Batch task. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public CloudTask getTask(String jobId, String taskId) throws BatchErrorException, IOException { + return getTask(jobId, taskId, null, null); + } + + /** + * Gets the specified {@link CloudTask}. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @param detailLevel + * A {@link DetailLevel} used for controlling which properties are + * retrieved from the service. + * @return A {@link CloudTask} containing information about the specified Azure + * Batch task. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public CloudTask getTask(String jobId, String taskId, DetailLevel detailLevel) + throws BatchErrorException, IOException { + return getTask(jobId, taskId, detailLevel, null); + } + + /** + * Gets the specified {@link CloudTask}. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @param detailLevel + * A {@link DetailLevel} used for controlling which properties are + * retrieved from the service. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @return A {@link CloudTask} containing information about the specified Azure + * Batch task. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public CloudTask getTask(String jobId, String taskId, DetailLevel detailLevel, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + TaskGetOptions options = new TaskGetOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); + bhMgr.applyRequestBehaviors(options); + + return this._parentBatchClient.protocolLayer().tasks().get(jobId, taskId, options); + } + + /** + * Updates the specified task. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @param constraints + * Constraints that apply to this task. If null, the task is given + * the default constraints. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void updateTask(String jobId, String taskId, TaskConstraints constraints) + throws BatchErrorException, IOException { + updateTask(jobId, taskId, constraints, null); + } + + /** + * Updates the specified task. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @param constraints + * Constraints that apply to this task. If null, the task is given + * the default constraints. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void updateTask(String jobId, String taskId, TaskConstraints constraints, + Iterable additionalBehaviors) throws BatchErrorException, IOException { + TaskUpdateOptions options = new TaskUpdateOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().tasks().update(jobId, taskId, constraints, options); + } + + /** + * Terminates the specified task. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void terminateTask(String jobId, String taskId) throws BatchErrorException, IOException { + terminateTask(jobId, taskId, null); + } + + /** + * Terminates the specified task. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void terminateTask(String jobId, String taskId, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + TaskTerminateOptions options = new TaskTerminateOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().tasks().terminate(jobId, taskId, options); + } + + /** + * Reactivates a task, allowing it to run again even if its retry count has been + * exhausted. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void reactivateTask(String jobId, String taskId) throws BatchErrorException, IOException { + reactivateTask(jobId, taskId, null); + } + + /** + * Reactivates a task, allowing it to run again even if its retry count has been + * exhausted. + * + * @param jobId + * The ID of the job containing the task. + * @param taskId + * The ID of the task. + * @param additionalBehaviors + * A collection of {@link BatchClientBehavior} instances that are + * applied to the Batch service request. + * @throws BatchErrorException + * Exception thrown when an error response is received from the + * Batch service. + * @throws IOException + * Exception thrown when there is an error in + * serialization/deserialization of data sent to/received from the + * Batch service. + */ + public void reactivateTask(String jobId, String taskId, Iterable additionalBehaviors) + throws BatchErrorException, IOException { + TaskReactivateOptions options = new TaskReactivateOptions(); + BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); + bhMgr.applyRequestBehaviors(options); + + this._parentBatchClient.protocolLayer().tasks().reactivate(jobId, taskId, options); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchApplicationTokenCredentials.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchApplicationTokenCredentials.java new file mode 100644 index 000000000000..cfa2a475b2db --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchApplicationTokenCredentials.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.auth; + +import com.microsoft.aad.adal4j.AuthenticationContext; +import com.microsoft.aad.adal4j.AuthenticationResult; +import com.microsoft.aad.adal4j.ClientCredential; +import com.microsoft.rest.credentials.TokenCredentials; +import okhttp3.Request; + +import java.io.IOException; +import java.util.Date; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * Application token based credentials for use with a Batch Service Client. + */ +public class BatchApplicationTokenCredentials extends TokenCredentials implements BatchCredentials { + + /** The Active Directory application client id. */ + final private String clientId; + /** The tenant or domain containing the application. */ + final private String domain; + /** The authentication secret for the application. */ + final private String secret; + /** The user's Batch service endpoint */ + final private String baseUrl; + /** The Batch service auth endpoint */ + final private String batchEndpoint; + /** The Active Directory auth endpoint */ + final private String authenticationEndpoint; + /** The cached access token. */ + private AuthenticationResult authenticationResult; + + /** + * Initializes a new instance of the BatchApplicationTokenCredentials. + * + * @param baseUrl the Batch service endpoint. + * @param clientId the Active Directory application client id. + * @param secret the authentication secret for the application. + * @param domain the domain or tenant id containing this application. + * @param batchEndpoint the Batch service endpoint to authenticate with. + * @param authenticationEndpoint the Active Directory endpoint to authenticate with. + */ + public BatchApplicationTokenCredentials(String baseUrl, String clientId, String secret, String domain, String batchEndpoint, String authenticationEndpoint) { + super(null, null); + + if (baseUrl == null) { + throw new IllegalArgumentException("Parameter baseUrl is required and cannot be null."); + } + if (clientId == null) { + throw new IllegalArgumentException("Parameter clientId is required and cannot be null."); + } + if (secret == null) { + throw new IllegalArgumentException("Parameter secret is required and cannot be null."); + } + if (domain == null) { + throw new IllegalArgumentException("Parameter domain is required and cannot be null."); + } + if (batchEndpoint == null) { + batchEndpoint = "https://batch.core.windows.net/"; + } + if (authenticationEndpoint == null) { + authenticationEndpoint = "https://login.microsoftonline.com/"; + } + + this.clientId = clientId; + this.baseUrl = baseUrl; + this.secret = secret; + this.domain = domain; + this.batchEndpoint = batchEndpoint; + this.authenticationEndpoint = authenticationEndpoint; + this.authenticationResult = null; + } + + /** + * Gets the Active Directory application client id. + * + * @return the active directory application client id. + */ + public String clientId() { + return this.clientId; + } + + /** + * Gets the tenant or domain containing the application. + * + * @return the tenant or domain containing the application. + */ + public String domain() { + return this.domain; + } + + /** + * Gets the Active Directory auth endpoint. + * + * @return the Active Directory auth endpoint. + */ + public String authenticationEndpoint() + { + return this.authenticationEndpoint; + } + + /** + * Gets the Batch service auth endpoint. + * + * @return the Batch service auth endpoint. + */ + public String batchEndpoint() + { + return this.batchEndpoint; + } + + /** + * Gets the Batch service endpoint + * + * @return The Batch service endpoint + */ + @Override + public String baseUrl() { + return this.baseUrl; + } + + @Override + public String getToken(Request request) throws IOException { + if (authenticationResult == null || authenticationResult.getExpiresOnDate().before(new Date())) { + this.authenticationResult = acquireAccessToken(); + } + return authenticationResult.getAccessToken(); + } + + private AuthenticationResult acquireAccessToken() throws IOException { + String authorityUrl = this.authenticationEndpoint() + this.domain(); + ExecutorService executor = Executors.newSingleThreadExecutor(); + AuthenticationContext context = new AuthenticationContext(authorityUrl, false, executor); + try { + this.authenticationResult = context.acquireToken( + this.batchEndpoint(), + new ClientCredential(this.clientId(), this.secret), + null).get(); + return this.authenticationResult; + } catch (Exception e) { + throw new IOException(e.getMessage(), e); + } finally { + executor.shutdown(); + } + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchCredentials.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchCredentials.java new file mode 100644 index 000000000000..2ab1e24eceba --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchCredentials.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.auth; + +import com.microsoft.rest.credentials.ServiceClientCredentials; + +/** + * Interface for credentials used to authenticate access to an Azure Batch account. + */ +public interface BatchCredentials extends ServiceClientCredentials { + /** + * Gets the Batch service endpoint. + * + * @return The Batch service endpoint. + */ + String baseUrl(); +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchSharedKeyCredentials.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchSharedKeyCredentials.java new file mode 100644 index 000000000000..7a45ba90a7ce --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchSharedKeyCredentials.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.auth; + +import okhttp3.OkHttpClient; + +/** + * Shared key credentials for an Azure Batch account. + */ +public class BatchSharedKeyCredentials implements BatchCredentials { + + private String accountName; + + private String keyValue; + + private String baseUrl; + + /** + * Gets the Batch account name. + * + * @return The Batch account name. + */ + public String accountName() { + return accountName; + } + + /** + * Gets the Base64 encoded account access key. + * + * @return The Base64 encoded account access key. + */ + public String keyValue() { + return keyValue; + } + + /** + * Initializes a new instance of the {@link BatchSharedKeyCredentials} class with the specified Batch service endpoint, account name, and access key. + * + * @param baseUrl The Batch service endpoint. + * @param accountName The Batch account name. + * @param keyValue The Batch access key. + */ + public BatchSharedKeyCredentials(String baseUrl, String accountName, String keyValue) { + + if (baseUrl == null) { + throw new IllegalArgumentException("Parameter baseUrl is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyValue == null) { + throw new IllegalArgumentException("Parameter keyValue is required and cannot be null."); + } + + this.baseUrl = baseUrl; + this.accountName = accountName; + this.keyValue = keyValue; + } + + /** + * Applies the credentials to the Batch service request. + * + * @param clientBuilder The client builder. + */ + @Override + public void applyCredentialsFilter(OkHttpClient.Builder clientBuilder) { + clientBuilder.interceptors().add(new BatchSharedKeyCredentialsInterceptor(this)); + } + + @Override + public String baseUrl() { + return this.baseUrl; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchSharedKeyCredentialsInterceptor.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchSharedKeyCredentialsInterceptor.java new file mode 100644 index 000000000000..2921830cd564 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchSharedKeyCredentialsInterceptor.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.auth; + +import com.microsoft.rest.DateTimeRfc1123; +import okhttp3.Interceptor; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.Response; +import org.apache.commons.codec.binary.Base64; +import org.joda.time.DateTime; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; +import java.net.URLDecoder; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Locale; +import java.util.Map; +import java.util.TreeMap; + +/** + * The interceptor class to insert Shared Key credential information to request HEADER. + */ +class BatchSharedKeyCredentialsInterceptor implements Interceptor { + + private final BatchSharedKeyCredentials credentials; + + private Mac hmacSha256; + + /** + * Constructor for BatchSharedKeyCredentialsInterceptor + * + * @param batchCredentials The account name/key credential + */ + BatchSharedKeyCredentialsInterceptor(BatchSharedKeyCredentials batchCredentials) { + this.credentials = batchCredentials; + } + + /** + * Inject the new authentication HEADER + * + * @param chain The interceptor chain + * @return Response of the request + * @throws IOException Exception thrown from serialization + */ + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Request newRequest = this.signHeader(chain.request()); + return chain.proceed(newRequest); + } + + private String headerValue(Request request, String headerName) { + String headerValue = request.header(headerName); + if (headerValue == null) { + return ""; + } + + return headerValue; + } + + private synchronized String sign(String stringToSign) { + try { + // Encoding the Signature + // Signature=Base64(HMAC-SHA256(UTF8(StringToSign))) + byte[] digest = getHmac256().doFinal(stringToSign.getBytes("UTF-8")); + return Base64.encodeBase64String(digest); + } catch (Exception e) { + throw new IllegalArgumentException("accessKey", e); + } + } + + private synchronized Mac getHmac256() throws NoSuchAlgorithmException, InvalidKeyException { + if (this.hmacSha256 == null) { + // Initializes the HMAC-SHA256 Mac and SecretKey. + this.hmacSha256 = Mac.getInstance("HmacSHA256"); + this.hmacSha256.init(new SecretKeySpec(Base64.decodeBase64(this.credentials.keyValue()), "HmacSHA256")); + } + return this.hmacSha256; + } + + private Request signHeader(Request request) throws IOException { + + Request.Builder builder = request.newBuilder(); + + // Set Headers + if (request.headers().get("ocp-date") == null) { + DateTimeRfc1123 rfcDate = new DateTimeRfc1123(new DateTime()); + builder.header("ocp-date", rfcDate.toString()); + request = builder.build(); + } + + String signature = request.method() + "\n"; + signature = signature + headerValue(request, "Content-Encoding") + + "\n"; + signature = signature + headerValue(request, "Content-Language") + + "\n"; + + // Special handle content length + long length = -1; + if (request.body() != null) { + length = request.body().contentLength(); + } + signature = signature + (length >= 0 ? Long.valueOf(length) : "") + + "\n"; + + signature = signature + headerValue(request, "Content-MD5") + "\n"; + + // Special handle content type header + String contentType = request.header("Content-Type"); + if (contentType == null) { + contentType = ""; + if (request.body() != null) { + MediaType mediaType = request.body().contentType(); + if (mediaType != null) { + contentType = mediaType.toString(); + } + } + } + signature = signature + contentType + "\n"; + + signature = signature + headerValue(request, "Date") + "\n"; + signature = signature + headerValue(request, "If-Modified-Since") + + "\n"; + signature = signature + headerValue(request, "If-Match") + "\n"; + signature = signature + headerValue(request, "If-None-Match") + "\n"; + signature = signature + headerValue(request, "If-Unmodified-Since") + + "\n"; + signature = signature + headerValue(request, "Range") + "\n"; + + ArrayList customHeaders = new ArrayList<>(); + for (String name : request.headers().names()) { + if (name.toLowerCase().startsWith("ocp-")) { + customHeaders.add(name.toLowerCase()); + } + } + Collections.sort(customHeaders); + for (String canonicalHeader : customHeaders) { + String value = request.header(canonicalHeader); + value = value.replace('\n', ' ').replace('\r', ' ') + .replaceAll("^[ ]+", ""); + signature = signature + canonicalHeader + ":" + value + "\n"; + } + + signature = signature + "/" + + credentials.accountName().toLowerCase() + "/" + + request.url().uri().getRawPath().replaceAll("^[/]+", ""); + + String query = request.url().query(); + if (query != null) { + Map queryComponents = new TreeMap<>(); + String[] pairs = query.split("&"); + for (String pair : pairs) { + int idx = pair.indexOf("="); + String key = URLDecoder.decode(pair.substring(0, idx), "UTF-8") + .toLowerCase(Locale.US); + queryComponents.put( + key, + key + ":" + URLDecoder.decode(pair.substring(idx + 1),"UTF-8")); + } + + for (Map.Entry entry : queryComponents.entrySet()) { + signature = signature + "\n" + entry.getValue(); + } + } + String signedSignature = sign(signature); + String authorization = "SharedKey " + credentials.accountName() + + ":" + signedSignature; + builder.header("Authorization", authorization); + + return builder.build(); + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchUserTokenCredentials.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchUserTokenCredentials.java new file mode 100644 index 000000000000..0107f687b82f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/BatchUserTokenCredentials.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.auth; + +import com.microsoft.aad.adal4j.AuthenticationContext; +import com.microsoft.aad.adal4j.AuthenticationResult; +import com.microsoft.rest.credentials.TokenCredentials; +import okhttp3.Request; + +import java.io.IOException; +import java.util.Date; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * User token based credentials for use with a Batch Service Client. + */ +public class BatchUserTokenCredentials extends TokenCredentials implements BatchCredentials { + + /** The Active Directory application client id. */ + final private String clientId; + /** The tenant or domain containing the application. */ + final private String domain; + /** The user name for the Organization Id account. */ + final private String username; + /** The password for the Organization Id account. */ + final private String password; + /** The user's Batch service endpoint */ + final private String baseUrl; + /** The Batch service auth endpoint */ + final private String batchEndpoint; + /** The Active Directory auth endpoint */ + final private String authenticationEndpoint; + /** The cached access token. */ + private AuthenticationResult authenticationResult; + + /** + * Initializes a new instance of the BatchUserTokenCredentials. + * + * @param baseUrl the Batch service endpoint. + * @param clientId the Active Directory application client id. + * @param username the user name for the Organization Id account. + * @param password the password for the Organization Id account. + * @param domain the domain or tenant id containing this application. + * @param batchEndpoint the Batch service endpoint to authenticate with. + * @param authenticationEndpoint the Active Directory endpoint to authenticate with. + */ + public BatchUserTokenCredentials(String baseUrl, String clientId, String username, String password, String domain, String batchEndpoint, String authenticationEndpoint) { + super(null, null); + + if (baseUrl == null) { + throw new IllegalArgumentException("Parameter baseUrl is required and cannot be null."); + } + if (clientId == null) { + throw new IllegalArgumentException("Parameter clientId is required and cannot be null."); + } + if (username == null) { + throw new IllegalArgumentException("Parameter username is required and cannot be null."); + } + if (password == null) { + throw new IllegalArgumentException("Parameter password is required and cannot be null."); + } + if (domain == null) { + throw new IllegalArgumentException("Parameter domain is required and cannot be null."); + } + if (batchEndpoint == null) { + batchEndpoint = "https://batch.core.windows.net/"; + } + if (authenticationEndpoint == null) { + authenticationEndpoint = "https://login.microsoftonline.com/"; + } + + this.clientId = clientId; + this.baseUrl = baseUrl; + this.username = username; + this.password = password; + this.domain = domain; + this.batchEndpoint = batchEndpoint; + this.authenticationEndpoint = authenticationEndpoint; + this.authenticationResult = null; + } + + /** + * Gets the Active Directory application client id. + * + * @return the active directory application client id. + */ + public String clientId() { + return this.clientId; + } + + /** + * Gets the tenant or domain containing the application. + * + * @return the tenant or domain containing the application. + */ + public String domain() { + return this.domain; + } + + /** + * Gets the user name for the Organization Id account. + * + * @return the user name. + */ + public String username() { return username; } + + /** + * Gets the Active Directory auth endpoint. + * + * @return the Active Directory auth endpoint. + */ + public String authenticationEndpoint() + { + return this.authenticationEndpoint; + } + + /** + * Gets the Batch service auth endpoint. + * + * @return the Batch service auth endpoint. + */ + public String batchEndpoint() + { + return this.batchEndpoint; + } + + /** + * Gets the Batch service endpoint + * + * @return The Batch service endpoint + */ + @Override + public String baseUrl() { + return this.baseUrl; + } + + @Override + public String getToken(Request request) throws IOException { + if (authenticationResult == null || authenticationResult.getExpiresOnDate().before(new Date())) { + this.authenticationResult = acquireAccessToken(); + } + return authenticationResult.getAccessToken(); + } + + private AuthenticationResult acquireAccessToken() throws IOException { + String authorityUrl = this.authenticationEndpoint() + this.domain(); + ExecutorService executor = Executors.newSingleThreadExecutor(); + AuthenticationContext context = new AuthenticationContext(authorityUrl, false, executor); + try { + this.authenticationResult = context.acquireToken( + this.batchEndpoint(), + this.clientId(), + this.username(), + this.password, + null).get(); + return this.authenticationResult; + } catch (Exception e) { + throw new IOException(e.getMessage(), e); + } finally { + executor.shutdown(); + } + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/package-info.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/package-info.java new file mode 100644 index 000000000000..854998a0ba7d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/auth/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * This package contains classes for authenticating requests against the Azure Batch service. + */ +package com.microsoft.azure.batch.auth; diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/BatchClientParallelOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/BatchClientParallelOptions.java new file mode 100644 index 000000000000..05a9ac73d580 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/BatchClientParallelOptions.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.interceptor; + +import com.microsoft.azure.batch.BatchClientBehavior; + +/** + * Stores options that configure the operation of methods on Batch client parallel operations. + */ +public class BatchClientParallelOptions extends BatchClientBehavior { + + private int maxDegreeOfParallelism; + + /** + * Gets the maximum number of concurrent tasks enabled by this {@link BatchClientParallelOptions} instance. + * + * The default value is 1. + * @return The maximum number of concurrent tasks. + */ + public int maxDegreeOfParallelism() { + return this.maxDegreeOfParallelism; + } + + /** + * Sets the maximum number of concurrent tasks enabled by this {@link BatchClientParallelOptions} instance. + * + * @param maxDegreeOfParallelism the maximum number of concurrent tasks. + * @return The instance of {@link BatchClientParallelOptions}. + */ + public BatchClientParallelOptions withMaxDegreeOfParallelism(int maxDegreeOfParallelism) { + if (maxDegreeOfParallelism > 0) { + this.maxDegreeOfParallelism = maxDegreeOfParallelism; + } + else { + throw new IllegalArgumentException("maxDegreeOfParallelism"); + } + return this; + } + + /** + * Initializes a new instance of the {@link BatchClientParallelOptions} class with default values. + */ + public BatchClientParallelOptions() { + this.maxDegreeOfParallelism = 1; + } + + /** + * Initializes a new instance of the {@link BatchClientParallelOptions} class. + * + * @param maxDegreeOfParallelism the maximum number of concurrent tasks. + */ + public BatchClientParallelOptions(int maxDegreeOfParallelism) { + this.maxDegreeOfParallelism = maxDegreeOfParallelism; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/BatchRequestInterceptHandler.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/BatchRequestInterceptHandler.java new file mode 100644 index 000000000000..b37e373b5743 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/BatchRequestInterceptHandler.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.interceptor; + +/** + * This interface enables an interceptor to modify a request to the Batch service. + */ +public interface BatchRequestInterceptHandler { + /** + * Modifies the request to the Batch service. + * + * @param request The outgoing Batch service request. + */ + void modify(Object request); +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/ClientRequestIdInterceptor.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/ClientRequestIdInterceptor.java new file mode 100644 index 000000000000..b5845aa9bcb8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/ClientRequestIdInterceptor.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.interceptor; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.UUID; + +/** + * Interceptor which contains a function used to generate a client request ID. + * If there are multiple instances of this then the last set wins. + */ +public class ClientRequestIdInterceptor extends RequestInterceptor { + /** + * Initializes a new {@link ClientRequestIdInterceptor} for use in setting the client request ID of a request. + */ + public ClientRequestIdInterceptor() { + this.withHandler(new BatchRequestInterceptHandler() { + @Override + public void modify(Object request) { + Class c = request.getClass(); + + try { + Method clientRequestIdMethod = c.getMethod("withClientRequestId", UUID.class); + if (clientRequestIdMethod != null) { + UUID clientRequestId = UUID.randomUUID(); + clientRequestIdMethod.invoke(request, clientRequestId); + } + + Method returnClientRequestIdMethod = c.getMethod("withReturnClientRequestId", Boolean.class); + if (returnClientRequestIdMethod != null) { + returnClientRequestIdMethod.invoke(request, true); + } + } + catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) { + // Ignore exception + } + } + }); + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/DetailLevelInterceptor.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/DetailLevelInterceptor.java new file mode 100644 index 000000000000..712bcf3291b5 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/DetailLevelInterceptor.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.interceptor; + +import com.microsoft.azure.batch.DetailLevel; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * Interceptor which contains a function used to apply the {@link DetailLevel}. + * If there are multiple instances of this then the last set wins. + */ +public class DetailLevelInterceptor extends RequestInterceptor { + + private final DetailLevel detailLevel; + + /** + * Initializes a new {@link DetailLevelInterceptor} for applying a {@link DetailLevel} object to a request. + * + * @param detailLevel The {@link DetailLevel} object. + */ + public DetailLevelInterceptor(final DetailLevel detailLevel) { + this.detailLevel = detailLevel; + this.withHandler(new BatchRequestInterceptHandler() { + @Override + public void modify(Object request) { + if (detailLevel != null) { + Class c = request.getClass(); + try { + Method selectMethod = c.getMethod("withSelect", String.class); + if (selectMethod != null) { + selectMethod.invoke(request, detailLevel.selectClause()); + } + } + catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) { + // Ignore exception + } + + try { + Method filterMethod = c.getMethod("withFilter", String.class); + if (filterMethod != null) { + filterMethod.invoke(request, detailLevel.filterClause()); + } + } + catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) { + // Ignore exception + } + + try { + Method expandMethod = c.getMethod("withExpand", String.class); + if (expandMethod != null) { + expandMethod.invoke(request, detailLevel.expandClause()); + } + } + catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) { + // Ignore exception + } + } + } + }); + } + + /** + * Gets the detail level applied by this {@link DetailLevelInterceptor} instance. + * + * @return The detail level applied. + */ + public DetailLevel detailLevel() { + return this.detailLevel; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/PageSizeInterceptor.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/PageSizeInterceptor.java new file mode 100644 index 000000000000..f907c18535f3 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/PageSizeInterceptor.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.interceptor; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * Interceptor which contains a function used to set the maximum page size of a request. + * If there are multiple instances of this then the last set wins. + */ +public class PageSizeInterceptor extends RequestInterceptor { + + private final int maxResults; + + /** + * Initializes a new {@link PageSizeInterceptor} for setting maximum page size of a request. + * + * @param pageSize The maximum number of items to return in a response. + */ + public PageSizeInterceptor(int pageSize) { + this.maxResults = pageSize; + this.withHandler(new BatchRequestInterceptHandler() { + @Override + public void modify(Object request) { + Class c = request.getClass(); + try { + Method maxResultsMethod = c.getMethod("withMaxResults", Integer.class); + if (maxResultsMethod != null) { + maxResultsMethod.invoke(request, maxResults); + } + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) { + // Ignore exception + } + } + }); + } + + /** + * Gets the maximum number of items applied by this {@link PageSizeInterceptor} instance. + * + * @return The maximum number of items to return in a response. + */ + public int maxResults() { + return this.maxResults; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/RequestInterceptor.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/RequestInterceptor.java new file mode 100644 index 000000000000..979562fd8b31 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/RequestInterceptor.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.interceptor; + +import com.microsoft.azure.batch.BatchClientBehavior; + +/** + * A {@link BatchClientBehavior} that modifies requests to the Batch service. + */ +public class RequestInterceptor extends BatchClientBehavior { + private BatchRequestInterceptHandler _handler; + + /** + * Initializes a new instance of RequestInterceptor. + */ + public RequestInterceptor() { + this._handler = new BatchRequestInterceptHandler() { + + @Override + public void modify(Object request) { + // DO NOTHING + } + }; + } + + /** + * Initializes a new instance of RequestInterceptor. + * + * @param handler The handler which will intercept requests to the Batch service. + */ + public RequestInterceptor(BatchRequestInterceptHandler handler) { + this._handler = handler; + } + + /** + * Gets the handler which will intercept requests to the Batch service. + * + * @return The handler which will intercept requests to the Batch service. + */ + public BatchRequestInterceptHandler handler() { + return _handler; + } + + /** + * Sets the handler which will intercept requests to the Batch service. + * + * @param handler The handler which will intercept requests to the Batch service. + * @return The current instance. + */ + public RequestInterceptor withHandler(BatchRequestInterceptHandler handler) { + this._handler = handler; + return this; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/ServerTimeoutInterceptor.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/ServerTimeoutInterceptor.java new file mode 100644 index 000000000000..9f3f4d9bd069 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/ServerTimeoutInterceptor.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch.interceptor; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * Sets Batch service request timeouts. + */ +public class ServerTimeoutInterceptor extends RequestInterceptor { + + private final int serverTimeout; + + /** + * Initializes a new {@link ServerTimeoutInterceptor} for setting the service timeout interval for a request issued to the Batch service. + * + * @param timeout The service timeout interval, in seconds. + */ + public ServerTimeoutInterceptor(int timeout) { + this.serverTimeout = timeout; + this.withHandler(new BatchRequestInterceptHandler() { + @Override + public void modify(Object request) { + Class c = request.getClass(); + try { + Method timeoutMethod = c.getMethod("withTimeout", Integer.class); + if (timeoutMethod != null) { + timeoutMethod.invoke(request, serverTimeout); + } + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) { + // Ignore exception + } + } + }); + } + + /** + * Gets the service timeout interval applied by this {@link ServerTimeoutInterceptor} instance. + * + * @return The service timeout interval, in seconds. + */ + public int serverTimeout() { + return this.serverTimeout; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/package-info.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/package-info.java new file mode 100644 index 000000000000..0795b2c99414 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/interceptor/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +/** + * This package contains classes for modifying requests to the Batch service. + */ +package com.microsoft.azure.batch.interceptor; diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/package-info.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/package-info.java new file mode 100644 index 000000000000..b2de32087e41 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * This package contains classes for writing applications that use the Azure Batch service. + */ +package com.microsoft.azure.batch; diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Accounts.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Accounts.java new file mode 100644 index 000000000000..0b2a5fee1275 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Accounts.java @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol; + +import com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusHeaders; +import com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusNextOptions; +import com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusOptions; +import com.microsoft.azure.batch.protocol.models.AccountListPoolNodeCountsHeaders; +import com.microsoft.azure.batch.protocol.models.AccountListPoolNodeCountsNextOptions; +import com.microsoft.azure.batch.protocol.models.AccountListPoolNodeCountsOptions; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.NodeAgentSku; +import com.microsoft.azure.batch.protocol.models.PoolNodeCounts; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Accounts. + */ +public interface Accounts { + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeAgentSku> object if successful. + */ + PagedList listNodeAgentSkus(); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listNodeAgentSkusAsync(final ListOperationCallback serviceCallback); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + Observable> listNodeAgentSkusAsync(); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusWithServiceResponseAsync(); + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param accountListNodeAgentSkusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeAgentSku> object if successful. + */ + PagedList listNodeAgentSkus(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param accountListNodeAgentSkusOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listNodeAgentSkusAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions, final ListOperationCallback serviceCallback); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param accountListNodeAgentSkusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + Observable> listNodeAgentSkusAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param accountListNodeAgentSkusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusWithServiceResponseAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolNodeCounts> object if successful. + */ + PagedList listPoolNodeCounts(); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listPoolNodeCountsAsync(final ListOperationCallback serviceCallback); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + Observable> listPoolNodeCountsAsync(); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsWithServiceResponseAsync(); + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param accountListPoolNodeCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolNodeCounts> object if successful. + */ + PagedList listPoolNodeCounts(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param accountListPoolNodeCountsOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listPoolNodeCountsAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions, final ListOperationCallback serviceCallback); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param accountListPoolNodeCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + Observable> listPoolNodeCountsAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param accountListPoolNodeCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsWithServiceResponseAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeAgentSku> object if successful. + */ + PagedList listNodeAgentSkusNext(final String nextPageLink); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @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 + */ + ServiceFuture> listNodeAgentSkusNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @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<NodeAgentSku> object + */ + Observable> listNodeAgentSkusNextAsync(final String nextPageLink); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @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<NodeAgentSku> object + */ + Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusNextWithServiceResponseAsync(final String nextPageLink); + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListNodeAgentSkusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeAgentSku> object if successful. + */ + PagedList listNodeAgentSkusNext(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListNodeAgentSkusNextOptions Additional parameters for the 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 + */ + ServiceFuture> listNodeAgentSkusNextAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListNodeAgentSkusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + Observable> listNodeAgentSkusNextAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions); + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListNodeAgentSkusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusNextWithServiceResponseAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolNodeCounts> object if successful. + */ + PagedList listPoolNodeCountsNext(final String nextPageLink); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @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 + */ + ServiceFuture> listPoolNodeCountsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @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<PoolNodeCounts> object + */ + Observable> listPoolNodeCountsNextAsync(final String nextPageLink); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @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<PoolNodeCounts> object + */ + Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsNextWithServiceResponseAsync(final String nextPageLink); + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListPoolNodeCountsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolNodeCounts> object if successful. + */ + PagedList listPoolNodeCountsNext(final String nextPageLink, final AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListPoolNodeCountsNextOptions Additional parameters for the 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 + */ + ServiceFuture> listPoolNodeCountsNextAsync(final String nextPageLink, final AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListPoolNodeCountsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + Observable> listPoolNodeCountsNextAsync(final String nextPageLink, final AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions); + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListPoolNodeCountsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsNextWithServiceResponseAsync(final String nextPageLink, final AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions); + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Applications.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Applications.java new file mode 100644 index 000000000000..2d1925b7c8d6 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Applications.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol; + +import com.microsoft.azure.batch.protocol.models.ApplicationGetHeaders; +import com.microsoft.azure.batch.protocol.models.ApplicationGetOptions; +import com.microsoft.azure.batch.protocol.models.ApplicationListHeaders; +import com.microsoft.azure.batch.protocol.models.ApplicationListNextOptions; +import com.microsoft.azure.batch.protocol.models.ApplicationListOptions; +import com.microsoft.azure.batch.protocol.models.ApplicationSummary; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Applications. + */ +public interface Applications { + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ApplicationSummary> object if successful. + */ + PagedList list(); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final ListOperationCallback serviceCallback); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + Observable> listAsync(); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + Observable, ApplicationListHeaders>> listWithServiceResponseAsync(); + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ApplicationSummary> object if successful. + */ + PagedList list(final ApplicationListOptions applicationListOptions); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationListOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final ApplicationListOptions applicationListOptions, final ListOperationCallback serviceCallback); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + Observable> listAsync(final ApplicationListOptions applicationListOptions); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + Observable, ApplicationListHeaders>> listWithServiceResponseAsync(final ApplicationListOptions applicationListOptions); + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplicationSummary object if successful. + */ + ApplicationSummary get(String applicationId); + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @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 + */ + ServiceFuture getAsync(String applicationId, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationSummary object + */ + Observable getAsync(String applicationId); + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationSummary object + */ + Observable> getWithServiceResponseAsync(String applicationId); + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @param applicationGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplicationSummary object if successful. + */ + ApplicationSummary get(String applicationId, ApplicationGetOptions applicationGetOptions); + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @param applicationGetOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String applicationId, ApplicationGetOptions applicationGetOptions, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @param applicationGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationSummary object + */ + Observable getAsync(String applicationId, ApplicationGetOptions applicationGetOptions); + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @param applicationGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationSummary object + */ + Observable> getWithServiceResponseAsync(String applicationId, ApplicationGetOptions applicationGetOptions); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ApplicationSummary> object if successful. + */ + PagedList listNext(final String nextPageLink); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @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<ApplicationSummary> object + */ + Observable> listNextAsync(final String nextPageLink); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @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<ApplicationSummary> object + */ + Observable, ApplicationListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink); + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param applicationListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ApplicationSummary> object if successful. + */ + PagedList listNext(final String nextPageLink, final ApplicationListNextOptions applicationListNextOptions); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param applicationListNextOptions Additional parameters for the 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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final ApplicationListNextOptions applicationListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param applicationListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + Observable> listNextAsync(final String nextPageLink, final ApplicationListNextOptions applicationListNextOptions); + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param applicationListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + Observable, ApplicationListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final ApplicationListNextOptions applicationListNextOptions); + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/BatchServiceClient.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/BatchServiceClient.java new file mode 100644 index 000000000000..099e16bf1a08 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/BatchServiceClient.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol; + +import com.microsoft.azure.AzureClient; +import com.microsoft.rest.RestClient; + +/** + * The interface for BatchServiceClient class. + */ +public interface BatchServiceClient { + /** + * Gets the REST client. + * + * @return the {@link RestClient} object. + */ + RestClient restClient(); + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + AzureClient getAzureClient(); + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + String userAgent(); + + /** + * Gets Client API Version.. + * + * @return the apiVersion value. + */ + String apiVersion(); + + /** + * Gets The base URL for all Azure Batch service requests.. + * + * @return the batchUrl value. + */ + String batchUrl(); + + /** + * Sets The base URL for all Azure Batch service requests.. + * + * @param batchUrl the batchUrl value. + * @return the service client itself + */ + BatchServiceClient withBatchUrl(String batchUrl); + + /** + * Gets The preferred language for the response.. + * + * @return the acceptLanguage value. + */ + String acceptLanguage(); + + /** + * Sets The preferred language for the response.. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + BatchServiceClient withAcceptLanguage(String acceptLanguage); + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @return the longRunningOperationRetryTimeout value. + */ + int 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 + */ + BatchServiceClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + + /** + * 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. + */ + boolean 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 + */ + BatchServiceClient withGenerateClientRequestId(boolean generateClientRequestId); + + /** + * Gets the Applications object to access its operations. + * @return the Applications object. + */ + Applications applications(); + + /** + * Gets the Pools object to access its operations. + * @return the Pools object. + */ + Pools pools(); + + /** + * Gets the Accounts object to access its operations. + * @return the Accounts object. + */ + Accounts accounts(); + + /** + * Gets the Jobs object to access its operations. + * @return the Jobs object. + */ + Jobs jobs(); + + /** + * Gets the Certificates object to access its operations. + * @return the Certificates object. + */ + Certificates certificates(); + + /** + * Gets the Files object to access its operations. + * @return the Files object. + */ + Files files(); + + /** + * Gets the JobSchedules object to access its operations. + * @return the JobSchedules object. + */ + JobSchedules jobSchedules(); + + /** + * Gets the Tasks object to access its operations. + * @return the Tasks object. + */ + Tasks tasks(); + + /** + * Gets the ComputeNodes object to access its operations. + * @return the ComputeNodes object. + */ + ComputeNodes computeNodes(); + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Certificates.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Certificates.java new file mode 100644 index 000000000000..1f1791b14890 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Certificates.java @@ -0,0 +1,550 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol; + +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.Certificate; +import com.microsoft.azure.batch.protocol.models.CertificateAddHeaders; +import com.microsoft.azure.batch.protocol.models.CertificateAddOptions; +import com.microsoft.azure.batch.protocol.models.CertificateAddParameter; +import com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionHeaders; +import com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionOptions; +import com.microsoft.azure.batch.protocol.models.CertificateDeleteHeaders; +import com.microsoft.azure.batch.protocol.models.CertificateDeleteOptions; +import com.microsoft.azure.batch.protocol.models.CertificateGetHeaders; +import com.microsoft.azure.batch.protocol.models.CertificateGetOptions; +import com.microsoft.azure.batch.protocol.models.CertificateListHeaders; +import com.microsoft.azure.batch.protocol.models.CertificateListNextOptions; +import com.microsoft.azure.batch.protocol.models.CertificateListOptions; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Certificates. + */ +public interface Certificates { + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void add(CertificateAddParameter certificate); + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addAsync(CertificateAddParameter certificate, final ServiceCallback serviceCallback); + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addAsync(CertificateAddParameter certificate); + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addWithServiceResponseAsync(CertificateAddParameter certificate); + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @param certificateAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void add(CertificateAddParameter certificate, CertificateAddOptions certificateAddOptions); + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @param certificateAddOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addAsync(CertificateAddParameter certificate, CertificateAddOptions certificateAddOptions, final ServiceCallback serviceCallback); + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @param certificateAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addAsync(CertificateAddParameter certificate, CertificateAddOptions certificateAddOptions); + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @param certificateAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addWithServiceResponseAsync(CertificateAddParameter certificate, CertificateAddOptions certificateAddOptions); + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<Certificate> object if successful. + */ + PagedList list(); + + /** + * Lists all of the certificates that have been added to the specified 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 + */ + ServiceFuture> listAsync(final ListOperationCallback serviceCallback); + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + Observable> listAsync(); + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + Observable, CertificateListHeaders>> listWithServiceResponseAsync(); + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param certificateListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<Certificate> object if successful. + */ + PagedList list(final CertificateListOptions certificateListOptions); + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param certificateListOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final CertificateListOptions certificateListOptions, final ListOperationCallback serviceCallback); + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param certificateListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + Observable> listAsync(final CertificateListOptions certificateListOptions); + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param certificateListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + Observable, CertificateListHeaders>> listWithServiceResponseAsync(final CertificateListOptions certificateListOptions); + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void cancelDeletion(String thumbprintAlgorithm, String thumbprint); + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being 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 + */ + ServiceFuture cancelDeletionAsync(String thumbprintAlgorithm, String thumbprint, final ServiceCallback serviceCallback); + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable cancelDeletionAsync(String thumbprintAlgorithm, String thumbprint); + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> cancelDeletionWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint); + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @param certificateCancelDeletionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void cancelDeletion(String thumbprintAlgorithm, String thumbprint, CertificateCancelDeletionOptions certificateCancelDeletionOptions); + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @param certificateCancelDeletionOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture cancelDeletionAsync(String thumbprintAlgorithm, String thumbprint, CertificateCancelDeletionOptions certificateCancelDeletionOptions, final ServiceCallback serviceCallback); + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @param certificateCancelDeletionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable cancelDeletionAsync(String thumbprintAlgorithm, String thumbprint, CertificateCancelDeletionOptions certificateCancelDeletionOptions); + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @param certificateCancelDeletionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> cancelDeletionWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint, CertificateCancelDeletionOptions certificateCancelDeletionOptions); + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String thumbprintAlgorithm, String thumbprint); + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate 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 + */ + ServiceFuture deleteAsync(String thumbprintAlgorithm, String thumbprint, final ServiceCallback serviceCallback); + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteAsync(String thumbprintAlgorithm, String thumbprint); + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint); + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @param certificateDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String thumbprintAlgorithm, String thumbprint, CertificateDeleteOptions certificateDeleteOptions); + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @param certificateDeleteOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteAsync(String thumbprintAlgorithm, String thumbprint, CertificateDeleteOptions certificateDeleteOptions, final ServiceCallback serviceCallback); + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @param certificateDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteAsync(String thumbprintAlgorithm, String thumbprint, CertificateDeleteOptions certificateDeleteOptions); + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @param certificateDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint, CertificateDeleteOptions certificateDeleteOptions); + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Certificate object if successful. + */ + Certificate get(String thumbprintAlgorithm, String thumbprint); + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String thumbprintAlgorithm, String thumbprint, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Certificate object + */ + Observable getAsync(String thumbprintAlgorithm, String thumbprint); + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Certificate object + */ + Observable> getWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint); + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @param certificateGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Certificate object if successful. + */ + Certificate get(String thumbprintAlgorithm, String thumbprint, CertificateGetOptions certificateGetOptions); + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @param certificateGetOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String thumbprintAlgorithm, String thumbprint, CertificateGetOptions certificateGetOptions, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @param certificateGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Certificate object + */ + Observable getAsync(String thumbprintAlgorithm, String thumbprint, CertificateGetOptions certificateGetOptions); + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @param certificateGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Certificate object + */ + Observable> getWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint, CertificateGetOptions certificateGetOptions); + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<Certificate> object if successful. + */ + PagedList listNext(final String nextPageLink); + + /** + * Lists all of the certificates that have been added to 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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the certificates that have been added to 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<Certificate> object + */ + Observable> listNextAsync(final String nextPageLink); + + /** + * Lists all of the certificates that have been added to 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<Certificate> object + */ + Observable, CertificateListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink); + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param certificateListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<Certificate> object if successful. + */ + PagedList listNext(final String nextPageLink, final CertificateListNextOptions certificateListNextOptions); + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param certificateListNextOptions Additional parameters for the 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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final CertificateListNextOptions certificateListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param certificateListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + Observable> listNextAsync(final String nextPageLink, final CertificateListNextOptions certificateListNextOptions); + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param certificateListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + Observable, CertificateListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final CertificateListNextOptions certificateListNextOptions); + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/ComputeNodes.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/ComputeNodes.java new file mode 100644 index 000000000000..c02c125a2d14 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/ComputeNodes.java @@ -0,0 +1,1321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol; + +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.ComputeNode; +import com.microsoft.azure.batch.protocol.models.ComputeNodeAddUserHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeAddUserOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeDeleteUserHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeDeleteUserOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeDisableSchedulingHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeDisableSchedulingOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeEnableSchedulingHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeEnableSchedulingOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteDesktopHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteDesktopOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteLoginSettingsHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteLoginSettingsOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteLoginSettingsResult; +import com.microsoft.azure.batch.protocol.models.ComputeNodeListHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeListNextOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeListOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeRebootHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeRebootOption; +import com.microsoft.azure.batch.protocol.models.ComputeNodeRebootOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeReimageHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeReimageOption; +import com.microsoft.azure.batch.protocol.models.ComputeNodeReimageOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeUpdateUserHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeUpdateUserOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeUploadBatchServiceLogsHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeUploadBatchServiceLogsOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeUser; +import com.microsoft.azure.batch.protocol.models.DisableComputeNodeSchedulingOption; +import com.microsoft.azure.batch.protocol.models.NodeUpdateUserParameter; +import com.microsoft.azure.batch.protocol.models.UploadBatchServiceLogsConfiguration; +import com.microsoft.azure.batch.protocol.models.UploadBatchServiceLogsResult; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.InputStream; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +// CUSTOM IMPORT +import java.io.OutputStream; + +/** + * An instance of this class provides access to all the operations defined + * in ComputeNodes. + */ +public interface ComputeNodes { + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void addUser(String poolId, String nodeId, ComputeNodeUser user); + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addUserAsync(String poolId, String nodeId, ComputeNodeUser user, final ServiceCallback serviceCallback); + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addUserAsync(String poolId, String nodeId, ComputeNodeUser user); + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addUserWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeUser user); + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @param computeNodeAddUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void addUser(String poolId, String nodeId, ComputeNodeUser user, ComputeNodeAddUserOptions computeNodeAddUserOptions); + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @param computeNodeAddUserOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addUserAsync(String poolId, String nodeId, ComputeNodeUser user, ComputeNodeAddUserOptions computeNodeAddUserOptions, final ServiceCallback serviceCallback); + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @param computeNodeAddUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addUserAsync(String poolId, String nodeId, ComputeNodeUser user, ComputeNodeAddUserOptions computeNodeAddUserOptions); + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @param computeNodeAddUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addUserWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeUser user, ComputeNodeAddUserOptions computeNodeAddUserOptions); + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void deleteUser(String poolId, String nodeId, String userName); + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account 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 + */ + ServiceFuture deleteUserAsync(String poolId, String nodeId, String userName, final ServiceCallback serviceCallback); + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteUserAsync(String poolId, String nodeId, String userName); + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteUserWithServiceResponseAsync(String poolId, String nodeId, String userName); + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @param computeNodeDeleteUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void deleteUser(String poolId, String nodeId, String userName, ComputeNodeDeleteUserOptions computeNodeDeleteUserOptions); + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @param computeNodeDeleteUserOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteUserAsync(String poolId, String nodeId, String userName, ComputeNodeDeleteUserOptions computeNodeDeleteUserOptions, final ServiceCallback serviceCallback); + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @param computeNodeDeleteUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteUserAsync(String poolId, String nodeId, String userName, ComputeNodeDeleteUserOptions computeNodeDeleteUserOptions); + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @param computeNodeDeleteUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteUserWithServiceResponseAsync(String poolId, String nodeId, String userName, ComputeNodeDeleteUserOptions computeNodeDeleteUserOptions); + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void updateUser(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter); + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter 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 + */ + ServiceFuture updateUserAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, final ServiceCallback serviceCallback); + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable updateUserAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter); + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> updateUserWithServiceResponseAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter); + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @param computeNodeUpdateUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void updateUser(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions); + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @param computeNodeUpdateUserOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateUserAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions, final ServiceCallback serviceCallback); + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @param computeNodeUpdateUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable updateUserAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions); + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @param computeNodeUpdateUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> updateUserWithServiceResponseAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions); + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ComputeNode object if successful. + */ + ComputeNode get(String poolId, String nodeId); + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String poolId, String nodeId, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNode object + */ + Observable getAsync(String poolId, String nodeId); + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNode object + */ + Observable> getWithServiceResponseAsync(String poolId, String nodeId); + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @param computeNodeGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ComputeNode object if successful. + */ + ComputeNode get(String poolId, String nodeId, ComputeNodeGetOptions computeNodeGetOptions); + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @param computeNodeGetOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String poolId, String nodeId, ComputeNodeGetOptions computeNodeGetOptions, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @param computeNodeGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNode object + */ + Observable getAsync(String poolId, String nodeId, ComputeNodeGetOptions computeNodeGetOptions); + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @param computeNodeGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNode object + */ + Observable> getWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeGetOptions computeNodeGetOptions); + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void reboot(String poolId, String nodeId); + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture rebootAsync(String poolId, String nodeId, final ServiceCallback serviceCallback); + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable rebootAsync(String poolId, String nodeId); + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> rebootWithServiceResponseAsync(String poolId, String nodeId); + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeRebootOption When to reboot the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeRebootOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void reboot(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions); + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeRebootOption When to reboot the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeRebootOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture rebootAsync(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions, final ServiceCallback serviceCallback); + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeRebootOption When to reboot the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeRebootOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable rebootAsync(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions); + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeRebootOption When to reboot the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeRebootOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> rebootWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions); + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void reimage(String poolId, String nodeId); + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture reimageAsync(String poolId, String nodeId, final ServiceCallback serviceCallback); + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable reimageAsync(String poolId, String nodeId); + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> reimageWithServiceResponseAsync(String poolId, String nodeId); + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeReimageOption When to reimage the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeReimageOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void reimage(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, ComputeNodeReimageOptions computeNodeReimageOptions); + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeReimageOption When to reimage the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeReimageOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture reimageAsync(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, ComputeNodeReimageOptions computeNodeReimageOptions, final ServiceCallback serviceCallback); + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeReimageOption When to reimage the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeReimageOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable reimageAsync(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, ComputeNodeReimageOptions computeNodeReimageOptions); + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeReimageOption When to reimage the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeReimageOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> reimageWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, ComputeNodeReimageOptions computeNodeReimageOptions); + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void disableScheduling(String poolId, String nodeId); + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture disableSchedulingAsync(String poolId, String nodeId, final ServiceCallback serviceCallback); + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable disableSchedulingAsync(String poolId, String nodeId); + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> disableSchedulingWithServiceResponseAsync(String poolId, String nodeId); + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @param nodeDisableSchedulingOption What to do with currently running tasks when disabling task scheduling on the compute node. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion' + * @param computeNodeDisableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void disableScheduling(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions); + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @param nodeDisableSchedulingOption What to do with currently running tasks when disabling task scheduling on the compute node. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion' + * @param computeNodeDisableSchedulingOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture disableSchedulingAsync(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions, final ServiceCallback serviceCallback); + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @param nodeDisableSchedulingOption What to do with currently running tasks when disabling task scheduling on the compute node. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion' + * @param computeNodeDisableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable disableSchedulingAsync(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions); + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @param nodeDisableSchedulingOption What to do with currently running tasks when disabling task scheduling on the compute node. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion' + * @param computeNodeDisableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> disableSchedulingWithServiceResponseAsync(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions); + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void enableScheduling(String poolId, String nodeId); + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture enableSchedulingAsync(String poolId, String nodeId, final ServiceCallback serviceCallback); + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable enableSchedulingAsync(String poolId, String nodeId); + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> enableSchedulingWithServiceResponseAsync(String poolId, String nodeId); + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @param computeNodeEnableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void enableScheduling(String poolId, String nodeId, ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions); + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @param computeNodeEnableSchedulingOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture enableSchedulingAsync(String poolId, String nodeId, ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions, final ServiceCallback serviceCallback); + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @param computeNodeEnableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable enableSchedulingAsync(String poolId, String nodeId, ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions); + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @param computeNodeEnableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> enableSchedulingWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions); + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ComputeNodeGetRemoteLoginSettingsResult object if successful. + */ + ComputeNodeGetRemoteLoginSettingsResult getRemoteLoginSettings(String poolId, String nodeId); + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getRemoteLoginSettingsAsync(String poolId, String nodeId, final ServiceCallback serviceCallback); + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNodeGetRemoteLoginSettingsResult object + */ + Observable getRemoteLoginSettingsAsync(String poolId, String nodeId); + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNodeGetRemoteLoginSettingsResult object + */ + Observable> getRemoteLoginSettingsWithServiceResponseAsync(String poolId, String nodeId); + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @param computeNodeGetRemoteLoginSettingsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ComputeNodeGetRemoteLoginSettingsResult object if successful. + */ + ComputeNodeGetRemoteLoginSettingsResult getRemoteLoginSettings(String poolId, String nodeId, ComputeNodeGetRemoteLoginSettingsOptions computeNodeGetRemoteLoginSettingsOptions); + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @param computeNodeGetRemoteLoginSettingsOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getRemoteLoginSettingsAsync(String poolId, String nodeId, ComputeNodeGetRemoteLoginSettingsOptions computeNodeGetRemoteLoginSettingsOptions, final ServiceCallback serviceCallback); + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @param computeNodeGetRemoteLoginSettingsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNodeGetRemoteLoginSettingsResult object + */ + Observable getRemoteLoginSettingsAsync(String poolId, String nodeId, ComputeNodeGetRemoteLoginSettingsOptions computeNodeGetRemoteLoginSettingsOptions); + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @param computeNodeGetRemoteLoginSettingsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNodeGetRemoteLoginSettingsResult object + */ + Observable> getRemoteLoginSettingsWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeGetRemoteLoginSettingsOptions computeNodeGetRemoteLoginSettingsOptions); + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol 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 + */ + ServiceFuture getRemoteDesktopAsync(String poolId, String nodeId, final ServiceCallback serviceCallback); + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable getRemoteDesktopAsync(String poolId, String nodeId); + + // CUSTOM METHOD + /** + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @param outputStream The OutputStream object which data will be written to if successful. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void getRemoteDesktop(String poolId, String nodeId, OutputStream outputStream); + + // CUSTOM METHOD + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @param computeNodeGetRemoteDesktopOptions Additional parameters for the operation + * @param outputStream The OutputStream object which data will be written to if successful. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void getRemoteDesktop(String poolId, String nodeId, ComputeNodeGetRemoteDesktopOptions computeNodeGetRemoteDesktopOptions, OutputStream outputStream); + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable> getRemoteDesktopWithServiceResponseAsync(String poolId, String nodeId); + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @param computeNodeGetRemoteDesktopOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getRemoteDesktopAsync(String poolId, String nodeId, ComputeNodeGetRemoteDesktopOptions computeNodeGetRemoteDesktopOptions, final ServiceCallback serviceCallback); + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @param computeNodeGetRemoteDesktopOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable getRemoteDesktopAsync(String poolId, String nodeId, ComputeNodeGetRemoteDesktopOptions computeNodeGetRemoteDesktopOptions); + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @param computeNodeGetRemoteDesktopOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable> getRemoteDesktopWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeGetRemoteDesktopOptions computeNodeGetRemoteDesktopOptions); + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UploadBatchServiceLogsResult object if successful. + */ + UploadBatchServiceLogsResult uploadBatchServiceLogs(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration); + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, final ServiceCallback serviceCallback); + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UploadBatchServiceLogsResult object + */ + Observable uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration); + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UploadBatchServiceLogsResult object + */ + Observable> uploadBatchServiceLogsWithServiceResponseAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration); + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @param computeNodeUploadBatchServiceLogsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UploadBatchServiceLogsResult object if successful. + */ + UploadBatchServiceLogsResult uploadBatchServiceLogs(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions); + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @param computeNodeUploadBatchServiceLogsOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions, final ServiceCallback serviceCallback); + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @param computeNodeUploadBatchServiceLogsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UploadBatchServiceLogsResult object + */ + Observable uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions); + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @param computeNodeUploadBatchServiceLogsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UploadBatchServiceLogsResult object + */ + Observable> uploadBatchServiceLogsWithServiceResponseAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions); + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ComputeNode> object if successful. + */ + PagedList list(final String poolId); + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final String poolId, final ListOperationCallback serviceCallback); + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + Observable> listAsync(final String poolId); + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + Observable, ComputeNodeListHeaders>> listWithServiceResponseAsync(final String poolId); + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @param computeNodeListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ComputeNode> object if successful. + */ + PagedList list(final String poolId, final ComputeNodeListOptions computeNodeListOptions); + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @param computeNodeListOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final String poolId, final ComputeNodeListOptions computeNodeListOptions, final ListOperationCallback serviceCallback); + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @param computeNodeListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + Observable> listAsync(final String poolId, final ComputeNodeListOptions computeNodeListOptions); + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @param computeNodeListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + Observable, ComputeNodeListHeaders>> listWithServiceResponseAsync(final String poolId, final ComputeNodeListOptions computeNodeListOptions); + + /** + * Lists the compute nodes in the specified pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ComputeNode> object if successful. + */ + PagedList listNext(final String nextPageLink); + + /** + * Lists the compute nodes in the specified pool. + * + * @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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists the compute nodes in the specified pool. + * + * @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<ComputeNode> object + */ + Observable> listNextAsync(final String nextPageLink); + + /** + * Lists the compute nodes in the specified pool. + * + * @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<ComputeNode> object + */ + Observable, ComputeNodeListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink); + /** + * Lists the compute nodes in the specified pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param computeNodeListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ComputeNode> object if successful. + */ + PagedList listNext(final String nextPageLink, final ComputeNodeListNextOptions computeNodeListNextOptions); + + /** + * Lists the compute nodes in the specified pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param computeNodeListNextOptions Additional parameters for the 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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final ComputeNodeListNextOptions computeNodeListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists the compute nodes in the specified pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param computeNodeListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + Observable> listNextAsync(final String nextPageLink, final ComputeNodeListNextOptions computeNodeListNextOptions); + + /** + * Lists the compute nodes in the specified pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param computeNodeListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + Observable, ComputeNodeListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final ComputeNodeListNextOptions computeNodeListNextOptions); + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Files.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Files.java new file mode 100644 index 000000000000..e7792241e1fa --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Files.java @@ -0,0 +1,1562 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol; + +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.FileDeleteFromComputeNodeHeaders; +import com.microsoft.azure.batch.protocol.models.FileDeleteFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileDeleteFromTaskHeaders; +import com.microsoft.azure.batch.protocol.models.FileDeleteFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.FileGetFromComputeNodeHeaders; +import com.microsoft.azure.batch.protocol.models.FileGetFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileGetFromTaskHeaders; +import com.microsoft.azure.batch.protocol.models.FileGetFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromComputeNodeHeaders; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromTaskHeaders; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.FileListFromComputeNodeHeaders; +import com.microsoft.azure.batch.protocol.models.FileListFromComputeNodeNextOptions; +import com.microsoft.azure.batch.protocol.models.FileListFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileListFromTaskHeaders; +import com.microsoft.azure.batch.protocol.models.FileListFromTaskNextOptions; +import com.microsoft.azure.batch.protocol.models.FileListFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.NodeFile; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.InputStream; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +// CUSTOM IMPORT +import java.io.OutputStream; + +/** + * An instance of this class provides access to all the operations defined in + * Files. + */ +public interface Files { + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to delete. + * @param filePath + * The path to the task file or directory that you want to delete. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void deleteFromTask(String jobId, String taskId, String filePath); + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to delete. + * @param filePath + * The path to the task file or directory that you want 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 + */ + ServiceFuture deleteFromTaskAsync(String jobId, String taskId, String filePath, + final ServiceCallback serviceCallback); + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to delete. + * @param filePath + * The path to the task file or directory that you want to delete. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteFromTaskAsync(String jobId, String taskId, String filePath); + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to delete. + * @param filePath + * The path to the task file or directory that you want to delete. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteFromTaskWithServiceResponseAsync( + String jobId, String taskId, String filePath); + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to delete. + * @param filePath + * The path to the task file or directory that you want to delete. + * @param recursive + * Whether to delete children of a directory. If the filePath + * parameter represents a directory instead of a file, you can set + * recursive to true to delete the directory and all of the files and + * subdirectories in it. If recursive is false then the directory + * must be empty or deletion will fail. + * @param fileDeleteFromTaskOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void deleteFromTask(String jobId, String taskId, String filePath, Boolean recursive, + FileDeleteFromTaskOptions fileDeleteFromTaskOptions); + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to delete. + * @param filePath + * The path to the task file or directory that you want to delete. + * @param recursive + * Whether to delete children of a directory. If the filePath + * parameter represents a directory instead of a file, you can set + * recursive to true to delete the directory and all of the files and + * subdirectories in it. If recursive is false then the directory + * must be empty or deletion will fail. + * @param fileDeleteFromTaskOptions + * Additional parameters for the operation + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteFromTaskAsync(String jobId, String taskId, String filePath, Boolean recursive, + FileDeleteFromTaskOptions fileDeleteFromTaskOptions, final ServiceCallback serviceCallback); + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to delete. + * @param filePath + * The path to the task file or directory that you want to delete. + * @param recursive + * Whether to delete children of a directory. If the filePath + * parameter represents a directory instead of a file, you can set + * recursive to true to delete the directory and all of the files and + * subdirectories in it. If recursive is false then the directory + * must be empty or deletion will fail. + * @param fileDeleteFromTaskOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteFromTaskAsync(String jobId, String taskId, String filePath, Boolean recursive, + FileDeleteFromTaskOptions fileDeleteFromTaskOptions); + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to delete. + * @param filePath + * The path to the task file or directory that you want to delete. + * @param recursive + * Whether to delete children of a directory. If the filePath + * parameter represents a directory instead of a file, you can set + * recursive to true to delete the directory and all of the files and + * subdirectories in it. If recursive is false then the directory + * must be empty or deletion will fail. + * @param fileDeleteFromTaskOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteFromTaskWithServiceResponseAsync( + String jobId, String taskId, String filePath, Boolean recursive, + FileDeleteFromTaskOptions fileDeleteFromTaskOptions); + + /** + * Returns the content of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to retrieve. + * @param filePath + * The path to the task file that you want to get the content of. + * @param outputStream + * The OutputStream object which data will be written to if + * successful. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void getFromTask(String jobId, String taskId, String filePath, OutputStream outputStream); + + /** + * Returns the content of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to retrieve. + * @param filePath + * The path to the task file that you want to get the content of. + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getFromTaskAsync(String jobId, String taskId, String filePath, + final ServiceCallback serviceCallback); + + /** + * Returns the content of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to retrieve. + * @param filePath + * The path to the task file that you want to get the content of. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable getFromTaskAsync(String jobId, String taskId, String filePath); + + /** + * Returns the content of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to retrieve. + * @param filePath + * The path to the task file that you want to get the content of. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable> getFromTaskWithServiceResponseAsync( + String jobId, String taskId, String filePath); + + /** + * Returns the content of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to retrieve. + * @param filePath + * The path to the task file that you want to get the content of. + * @param fileGetFromTaskOptions + * Additional parameters for the operation + * @param outputStream + * The OutputStream object which data will be written to if + * successful. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void getFromTask(String jobId, String taskId, String filePath, FileGetFromTaskOptions fileGetFromTaskOptions, + OutputStream outputStream); + + /** + * Returns the content of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to retrieve. + * @param filePath + * The path to the task file that you want to get the content of. + * @param fileGetFromTaskOptions + * Additional parameters for the operation + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getFromTaskAsync(String jobId, String taskId, String filePath, + FileGetFromTaskOptions fileGetFromTaskOptions, final ServiceCallback serviceCallback); + + /** + * Returns the content of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to retrieve. + * @param filePath + * The path to the task file that you want to get the content of. + * @param fileGetFromTaskOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable getFromTaskAsync(String jobId, String taskId, String filePath, + FileGetFromTaskOptions fileGetFromTaskOptions); + + /** + * Returns the content of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to retrieve. + * @param filePath + * The path to the task file that you want to get the content of. + * @param fileGetFromTaskOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable> getFromTaskWithServiceResponseAsync( + String jobId, String taskId, String filePath, FileGetFromTaskOptions fileGetFromTaskOptions); + + /** + * Gets the properties of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to get the properties of. + * @param filePath + * The path to the task file that you want to get the properties of. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void getPropertiesFromTask(String jobId, String taskId, String filePath); + + /** + * Gets the properties of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to get the properties of. + * @param filePath + * The path to the task file that you want to get the properties of. + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getPropertiesFromTaskAsync(String jobId, String taskId, String filePath, + final ServiceCallback serviceCallback); + + /** + * Gets the properties of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to get the properties of. + * @param filePath + * The path to the task file that you want to get the properties of. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable getPropertiesFromTaskAsync(String jobId, String taskId, String filePath); + + /** + * Gets the properties of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to get the properties of. + * @param filePath + * The path to the task file that you want to get the properties of. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> getPropertiesFromTaskWithServiceResponseAsync( + String jobId, String taskId, String filePath); + + /** + * Gets the properties of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to get the properties of. + * @param filePath + * The path to the task file that you want to get the properties of. + * @param fileGetPropertiesFromTaskOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void getPropertiesFromTask(String jobId, String taskId, String filePath, + FileGetPropertiesFromTaskOptions fileGetPropertiesFromTaskOptions); + + /** + * Gets the properties of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to get the properties of. + * @param filePath + * The path to the task file that you want to get the properties of. + * @param fileGetPropertiesFromTaskOptions + * Additional parameters for the operation + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getPropertiesFromTaskAsync(String jobId, String taskId, String filePath, + FileGetPropertiesFromTaskOptions fileGetPropertiesFromTaskOptions, + final ServiceCallback serviceCallback); + + /** + * Gets the properties of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to get the properties of. + * @param filePath + * The path to the task file that you want to get the properties of. + * @param fileGetPropertiesFromTaskOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable getPropertiesFromTaskAsync(String jobId, String taskId, String filePath, + FileGetPropertiesFromTaskOptions fileGetPropertiesFromTaskOptions); + + /** + * Gets the properties of the specified task file. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose file you want to get the properties of. + * @param filePath + * The path to the task file that you want to get the properties of. + * @param fileGetPropertiesFromTaskOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> getPropertiesFromTaskWithServiceResponseAsync( + String jobId, String taskId, String filePath, + FileGetPropertiesFromTaskOptions fileGetPropertiesFromTaskOptions); + + /** + * Deletes the specified file from the compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node from which you want to delete the file. + * @param filePath + * The path to the file or directory that you want to delete. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void deleteFromComputeNode(String poolId, String nodeId, String filePath); + + /** + * Deletes the specified file from the compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node from which you want to delete the file. + * @param filePath + * The path to the file or directory that you want 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 + */ + ServiceFuture deleteFromComputeNodeAsync(String poolId, String nodeId, String filePath, + final ServiceCallback serviceCallback); + + /** + * Deletes the specified file from the compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node from which you want to delete the file. + * @param filePath + * The path to the file or directory that you want to delete. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteFromComputeNodeAsync(String poolId, String nodeId, String filePath); + + /** + * Deletes the specified file from the compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node from which you want to delete the file. + * @param filePath + * The path to the file or directory that you want to delete. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteFromComputeNodeWithServiceResponseAsync( + String poolId, String nodeId, String filePath); + + /** + * Deletes the specified file from the compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node from which you want to delete the file. + * @param filePath + * The path to the file or directory that you want to delete. + * @param recursive + * Whether to delete children of a directory. If the filePath + * parameter represents a directory instead of a file, you can set + * recursive to true to delete the directory and all of the files and + * subdirectories in it. If recursive is false then the directory + * must be empty or deletion will fail. + * @param fileDeleteFromComputeNodeOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void deleteFromComputeNode(String poolId, String nodeId, String filePath, Boolean recursive, + FileDeleteFromComputeNodeOptions fileDeleteFromComputeNodeOptions); + + /** + * Deletes the specified file from the compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node from which you want to delete the file. + * @param filePath + * The path to the file or directory that you want to delete. + * @param recursive + * Whether to delete children of a directory. If the filePath + * parameter represents a directory instead of a file, you can set + * recursive to true to delete the directory and all of the files and + * subdirectories in it. If recursive is false then the directory + * must be empty or deletion will fail. + * @param fileDeleteFromComputeNodeOptions + * Additional parameters for the operation + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteFromComputeNodeAsync(String poolId, String nodeId, String filePath, Boolean recursive, + FileDeleteFromComputeNodeOptions fileDeleteFromComputeNodeOptions, + final ServiceCallback serviceCallback); + + /** + * Deletes the specified file from the compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node from which you want to delete the file. + * @param filePath + * The path to the file or directory that you want to delete. + * @param recursive + * Whether to delete children of a directory. If the filePath + * parameter represents a directory instead of a file, you can set + * recursive to true to delete the directory and all of the files and + * subdirectories in it. If recursive is false then the directory + * must be empty or deletion will fail. + * @param fileDeleteFromComputeNodeOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteFromComputeNodeAsync(String poolId, String nodeId, String filePath, Boolean recursive, + FileDeleteFromComputeNodeOptions fileDeleteFromComputeNodeOptions); + + /** + * Deletes the specified file from the compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node from which you want to delete the file. + * @param filePath + * The path to the file or directory that you want to delete. + * @param recursive + * Whether to delete children of a directory. If the filePath + * parameter represents a directory instead of a file, you can set + * recursive to true to delete the directory and all of the files and + * subdirectories in it. If recursive is false then the directory + * must be empty or deletion will fail. + * @param fileDeleteFromComputeNodeOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteFromComputeNodeWithServiceResponseAsync( + String poolId, String nodeId, String filePath, Boolean recursive, + FileDeleteFromComputeNodeOptions fileDeleteFromComputeNodeOptions); + + // CUSTOM METHOD + /** + * Returns the content of the specified task file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the content + * of. + * @param outputStream + * The OutputStream object which data will be written to if + * successful. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void getFromComputeNode(String poolId, String nodeId, String filePath, OutputStream outputStream); + + /** + * Returns the content of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the content + * of. + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getFromComputeNodeAsync(String poolId, String nodeId, String filePath, + final ServiceCallback serviceCallback); + + /** + * Returns the content of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the content + * of. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable getFromComputeNodeAsync(String poolId, String nodeId, String filePath); + + /** + * Returns the content of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the content + * of. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable> getFromComputeNodeWithServiceResponseAsync( + String poolId, String nodeId, String filePath); + + // CUSTOM METHOD + /** + * Returns the content of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the content + * of. + * @param fileGetFromComputeNodeOptions + * Additional parameters for the operation + * @param outputStream + * The OutputStream object which data will be written to if + * successful. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void getFromComputeNode(String poolId, String nodeId, String filePath, + FileGetFromComputeNodeOptions fileGetFromComputeNodeOptions, OutputStream outputStream); + + /** + * Returns the content of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the content + * of. + * @param fileGetFromComputeNodeOptions + * Additional parameters for the operation + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getFromComputeNodeAsync(String poolId, String nodeId, String filePath, + FileGetFromComputeNodeOptions fileGetFromComputeNodeOptions, + final ServiceCallback serviceCallback); + + /** + * Returns the content of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the content + * of. + * @param fileGetFromComputeNodeOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable getFromComputeNodeAsync(String poolId, String nodeId, String filePath, + FileGetFromComputeNodeOptions fileGetFromComputeNodeOptions); + + /** + * Returns the content of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the content + * of. + * @param fileGetFromComputeNodeOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable> getFromComputeNodeWithServiceResponseAsync( + String poolId, String nodeId, String filePath, FileGetFromComputeNodeOptions fileGetFromComputeNodeOptions); + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the + * properties of. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void getPropertiesFromComputeNode(String poolId, String nodeId, String filePath); + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the + * properties of. + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getPropertiesFromComputeNodeAsync(String poolId, String nodeId, String filePath, + final ServiceCallback serviceCallback); + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the + * properties of. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable getPropertiesFromComputeNodeAsync(String poolId, String nodeId, String filePath); + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the + * properties of. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> getPropertiesFromComputeNodeWithServiceResponseAsync( + String poolId, String nodeId, String filePath); + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the + * properties of. + * @param fileGetPropertiesFromComputeNodeOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * thrown if the request is rejected by server + * @throws RuntimeException + * all other wrapped checked exceptions if the request fails to be + * sent + */ + void getPropertiesFromComputeNode(String poolId, String nodeId, String filePath, + FileGetPropertiesFromComputeNodeOptions fileGetPropertiesFromComputeNodeOptions); + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the + * properties of. + * @param fileGetPropertiesFromComputeNodeOptions + * Additional parameters for the operation + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getPropertiesFromComputeNodeAsync(String poolId, String nodeId, String filePath, + FileGetPropertiesFromComputeNodeOptions fileGetPropertiesFromComputeNodeOptions, + final ServiceCallback serviceCallback); + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the + * properties of. + * @param fileGetPropertiesFromComputeNodeOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable getPropertiesFromComputeNodeAsync(String poolId, String nodeId, String filePath, + FileGetPropertiesFromComputeNodeOptions fileGetPropertiesFromComputeNodeOptions); + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node that contains the file. + * @param filePath + * The path to the compute node file that you want to get the + * properties of. + * @param fileGetPropertiesFromComputeNodeOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> getPropertiesFromComputeNodeWithServiceResponseAsync( + String poolId, String nodeId, String filePath, + FileGetPropertiesFromComputeNodeOptions fileGetPropertiesFromComputeNodeOptions); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose files you want to list. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * 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<NodeFile> object if successful. + */ + PagedList listFromTask(final String jobId, final String taskId); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose files you want 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 + */ + ServiceFuture> listFromTaskAsync(final String jobId, final String taskId, + final ListOperationCallback serviceCallback); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose files you want to list. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable> listFromTaskAsync(final String jobId, final String taskId); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose files you want to list. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable, FileListFromTaskHeaders>> listFromTaskWithServiceResponseAsync( + final String jobId, final String taskId); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose files you want to list. + * @param recursive + * Whether to list children of the task directory. This parameter can + * be used in combination with the filter parameter to list specific + * type of files. + * @param fileListFromTaskOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * 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<NodeFile> object if successful. + */ + PagedList listFromTask(final String jobId, final String taskId, final Boolean recursive, + final FileListFromTaskOptions fileListFromTaskOptions); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose files you want to list. + * @param recursive + * Whether to list children of the task directory. This parameter can + * be used in combination with the filter parameter to list specific + * type of files. + * @param fileListFromTaskOptions + * Additional parameters for the operation + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listFromTaskAsync(final String jobId, final String taskId, final Boolean recursive, + final FileListFromTaskOptions fileListFromTaskOptions, + final ListOperationCallback serviceCallback); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose files you want to list. + * @param recursive + * Whether to list children of the task directory. This parameter can + * be used in combination with the filter parameter to list specific + * type of files. + * @param fileListFromTaskOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable> listFromTaskAsync(final String jobId, final String taskId, final Boolean recursive, + final FileListFromTaskOptions fileListFromTaskOptions); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId + * The ID of the job that contains the task. + * @param taskId + * The ID of the task whose files you want to list. + * @param recursive + * Whether to list children of the task directory. This parameter can + * be used in combination with the filter parameter to list specific + * type of files. + * @param fileListFromTaskOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable, FileListFromTaskHeaders>> listFromTaskWithServiceResponseAsync( + final String jobId, final String taskId, final Boolean recursive, + final FileListFromTaskOptions fileListFromTaskOptions); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node whose files you want to list. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * 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<NodeFile> object if successful. + */ + PagedList listFromComputeNode(final String poolId, final String nodeId); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node whose files you want 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 + */ + ServiceFuture> listFromComputeNodeAsync(final String poolId, final String nodeId, + final ListOperationCallback serviceCallback); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node whose files you want to list. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable> listFromComputeNodeAsync(final String poolId, final String nodeId); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node whose files you want to list. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeWithServiceResponseAsync( + final String poolId, final String nodeId); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node whose files you want to list. + * @param recursive + * Whether to list children of a directory. + * @param fileListFromComputeNodeOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * 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<NodeFile> object if successful. + */ + PagedList listFromComputeNode(final String poolId, final String nodeId, final Boolean recursive, + final FileListFromComputeNodeOptions fileListFromComputeNodeOptions); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node whose files you want to list. + * @param recursive + * Whether to list children of a directory. + * @param fileListFromComputeNodeOptions + * Additional parameters for the operation + * @param serviceCallback + * the async ServiceCallback to handle successful and failed + * responses. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listFromComputeNodeAsync(final String poolId, final String nodeId, + final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions, + final ListOperationCallback serviceCallback); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node whose files you want to list. + * @param recursive + * Whether to list children of a directory. + * @param fileListFromComputeNodeOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable> listFromComputeNodeAsync(final String poolId, final String nodeId, + final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId + * The ID of the pool that contains the compute node. + * @param nodeId + * The ID of the compute node whose files you want to list. + * @param recursive + * Whether to list children of a directory. + * @param fileListFromComputeNodeOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeWithServiceResponseAsync( + final String poolId, final String nodeId, final Boolean recursive, + final FileListFromComputeNodeOptions fileListFromComputeNodeOptions); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param nextPageLink + * The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * 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<NodeFile> object if successful. + */ + PagedList listFromTaskNext(final String nextPageLink); + + /** + * Lists the files in a task's directory on its compute node. + * + * @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 + */ + ServiceFuture> listFromTaskNextAsync(final String nextPageLink, + final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists the files in a task's directory on its compute node. + * + * @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<NodeFile> object + */ + Observable> listFromTaskNextAsync(final String nextPageLink); + + /** + * Lists the files in a task's directory on its compute node. + * + * @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<NodeFile> object + */ + Observable, FileListFromTaskHeaders>> listFromTaskNextWithServiceResponseAsync( + final String nextPageLink); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param nextPageLink + * The NextLink from the previous successful call to List operation. + * @param fileListFromTaskNextOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * 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<NodeFile> object if successful. + */ + PagedList listFromTaskNext(final String nextPageLink, + final FileListFromTaskNextOptions fileListFromTaskNextOptions); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param nextPageLink + * The NextLink from the previous successful call to List operation. + * @param fileListFromTaskNextOptions + * Additional parameters for the 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 + */ + ServiceFuture> listFromTaskNextAsync(final String nextPageLink, + final FileListFromTaskNextOptions fileListFromTaskNextOptions, + final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param nextPageLink + * The NextLink from the previous successful call to List operation. + * @param fileListFromTaskNextOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable> listFromTaskNextAsync(final String nextPageLink, + final FileListFromTaskNextOptions fileListFromTaskNextOptions); + + /** + * Lists the files in a task's directory on its compute node. + * + * @param nextPageLink + * The NextLink from the previous successful call to List operation. + * @param fileListFromTaskNextOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable, FileListFromTaskHeaders>> listFromTaskNextWithServiceResponseAsync( + final String nextPageLink, final FileListFromTaskNextOptions fileListFromTaskNextOptions); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param nextPageLink + * The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * 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<NodeFile> object if successful. + */ + PagedList listFromComputeNodeNext(final String nextPageLink); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @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 + */ + ServiceFuture> listFromComputeNodeNextAsync(final String nextPageLink, + final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @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<NodeFile> object + */ + Observable> listFromComputeNodeNextAsync(final String nextPageLink); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @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<NodeFile> object + */ + Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeNextWithServiceResponseAsync( + final String nextPageLink); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param nextPageLink + * The NextLink from the previous successful call to List operation. + * @param fileListFromComputeNodeNextOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @throws BatchErrorException + * 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<NodeFile> object if successful. + */ + PagedList listFromComputeNodeNext(final String nextPageLink, + final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param nextPageLink + * The NextLink from the previous successful call to List operation. + * @param fileListFromComputeNodeNextOptions + * Additional parameters for the 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 + */ + ServiceFuture> listFromComputeNodeNextAsync(final String nextPageLink, + final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions, + final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param nextPageLink + * The NextLink from the previous successful call to List operation. + * @param fileListFromComputeNodeNextOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable> listFromComputeNodeNextAsync(final String nextPageLink, + final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions); + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param nextPageLink + * The NextLink from the previous successful call to List operation. + * @param fileListFromComputeNodeNextOptions + * Additional parameters for the operation + * @throws IllegalArgumentException + * thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeNextWithServiceResponseAsync( + final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions); + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/JobSchedules.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/JobSchedules.java new file mode 100644 index 000000000000..c66e48519abc --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/JobSchedules.java @@ -0,0 +1,967 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol; + +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.CloudJobSchedule; +import com.microsoft.azure.batch.protocol.models.JobScheduleAddHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleAddOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleAddParameter; +import com.microsoft.azure.batch.protocol.models.JobScheduleDeleteHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleDeleteOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleDisableHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleDisableOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleEnableHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleEnableOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleExistsHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleExistsOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleGetHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleGetOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleListHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleListNextOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleListOptions; +import com.microsoft.azure.batch.protocol.models.JobSchedulePatchHeaders; +import com.microsoft.azure.batch.protocol.models.JobSchedulePatchOptions; +import com.microsoft.azure.batch.protocol.models.JobSchedulePatchParameter; +import com.microsoft.azure.batch.protocol.models.JobScheduleTerminateHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleTerminateOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleUpdateHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleUpdateOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleUpdateParameter; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in JobSchedules. + */ +public interface JobSchedules { + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + boolean exists(String jobScheduleId); + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture existsAsync(String jobScheduleId, final ServiceCallback serviceCallback); + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the boolean object + */ + Observable existsAsync(String jobScheduleId); + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the boolean object + */ + Observable> existsWithServiceResponseAsync(String jobScheduleId); + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @param jobScheduleExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + boolean exists(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions); + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @param jobScheduleExistsOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture existsAsync(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions, final ServiceCallback serviceCallback); + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @param jobScheduleExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the boolean object + */ + Observable existsAsync(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions); + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @param jobScheduleExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the boolean object + */ + Observable> existsWithServiceResponseAsync(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions); + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String jobScheduleId); + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule 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 + */ + ServiceFuture deleteAsync(String jobScheduleId, final ServiceCallback serviceCallback); + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteAsync(String jobScheduleId); + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String jobScheduleId); + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @param jobScheduleDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions); + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @param jobScheduleDeleteOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteAsync(String jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions, final ServiceCallback serviceCallback); + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @param jobScheduleDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteAsync(String jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions); + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @param jobScheduleDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions); + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudJobSchedule object if successful. + */ + CloudJobSchedule get(String jobScheduleId); + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String jobScheduleId, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJobSchedule object + */ + Observable getAsync(String jobScheduleId); + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJobSchedule object + */ + Observable> getWithServiceResponseAsync(String jobScheduleId); + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @param jobScheduleGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudJobSchedule object if successful. + */ + CloudJobSchedule get(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions); + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @param jobScheduleGetOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @param jobScheduleGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJobSchedule object + */ + Observable getAsync(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions); + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @param jobScheduleGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJobSchedule object + */ + Observable> getWithServiceResponseAsync(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions); + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void patch(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter); + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter 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 + */ + ServiceFuture patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter); + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> patchWithServiceResponseAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter); + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @param jobSchedulePatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void patch(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions); + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @param jobSchedulePatchOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @param jobSchedulePatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions); + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @param jobSchedulePatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> patchWithServiceResponseAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions); + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter); + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter 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 + */ + ServiceFuture updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter); + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> updateWithServiceResponseAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter); + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @param jobScheduleUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions); + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @param jobScheduleUpdateOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @param jobScheduleUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions); + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @param jobScheduleUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> updateWithServiceResponseAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions); + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void disable(String jobScheduleId); + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture disableAsync(String jobScheduleId, final ServiceCallback serviceCallback); + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable disableAsync(String jobScheduleId); + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> disableWithServiceResponseAsync(String jobScheduleId); + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @param jobScheduleDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void disable(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions); + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @param jobScheduleDisableOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture disableAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions, final ServiceCallback serviceCallback); + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @param jobScheduleDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable disableAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions); + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @param jobScheduleDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> disableWithServiceResponseAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions); + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void enable(String jobScheduleId); + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture enableAsync(String jobScheduleId, final ServiceCallback serviceCallback); + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable enableAsync(String jobScheduleId); + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> enableWithServiceResponseAsync(String jobScheduleId); + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @param jobScheduleEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void enable(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions); + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @param jobScheduleEnableOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture enableAsync(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions, final ServiceCallback serviceCallback); + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @param jobScheduleEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable enableAsync(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions); + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @param jobScheduleEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> enableWithServiceResponseAsync(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions); + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void terminate(String jobScheduleId); + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture terminateAsync(String jobScheduleId, final ServiceCallback serviceCallback); + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable terminateAsync(String jobScheduleId); + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> terminateWithServiceResponseAsync(String jobScheduleId); + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @param jobScheduleTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void terminate(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions); + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @param jobScheduleTerminateOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture terminateAsync(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions, final ServiceCallback serviceCallback); + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @param jobScheduleTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable terminateAsync(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions); + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @param jobScheduleTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> terminateWithServiceResponseAsync(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions); + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void add(JobScheduleAddParameter cloudJobSchedule); + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addAsync(JobScheduleAddParameter cloudJobSchedule, final ServiceCallback serviceCallback); + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addAsync(JobScheduleAddParameter cloudJobSchedule); + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addWithServiceResponseAsync(JobScheduleAddParameter cloudJobSchedule); + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @param jobScheduleAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void add(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions); + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @param jobScheduleAddOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addAsync(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions, final ServiceCallback serviceCallback); + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @param jobScheduleAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addAsync(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions); + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @param jobScheduleAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addWithServiceResponseAsync(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions); + + /** + * Lists all of the job schedules in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJobSchedule> object if successful. + */ + PagedList list(); + + /** + * Lists all of the job schedules in the specified 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 + */ + ServiceFuture> listAsync(final ListOperationCallback serviceCallback); + + /** + * Lists all of the job schedules in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + Observable> listAsync(); + + /** + * Lists all of the job schedules in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + Observable, JobScheduleListHeaders>> listWithServiceResponseAsync(); + /** + * Lists all of the job schedules in the specified account. + * + * @param jobScheduleListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJobSchedule> object if successful. + */ + PagedList list(final JobScheduleListOptions jobScheduleListOptions); + + /** + * Lists all of the job schedules in the specified account. + * + * @param jobScheduleListOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final JobScheduleListOptions jobScheduleListOptions, final ListOperationCallback serviceCallback); + + /** + * Lists all of the job schedules in the specified account. + * + * @param jobScheduleListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + Observable> listAsync(final JobScheduleListOptions jobScheduleListOptions); + + /** + * Lists all of the job schedules in the specified account. + * + * @param jobScheduleListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + Observable, JobScheduleListHeaders>> listWithServiceResponseAsync(final JobScheduleListOptions jobScheduleListOptions); + + /** + * Lists all of the job schedules 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 BatchErrorException 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<CloudJobSchedule> object if successful. + */ + PagedList listNext(final String nextPageLink); + + /** + * Lists all of the job schedules 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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the job schedules 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<CloudJobSchedule> object + */ + Observable> listNextAsync(final String nextPageLink); + + /** + * Lists all of the job schedules 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<CloudJobSchedule> object + */ + Observable, JobScheduleListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink); + /** + * Lists all of the job schedules in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobScheduleListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJobSchedule> object if successful. + */ + PagedList listNext(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions); + + /** + * Lists all of the job schedules in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobScheduleListNextOptions Additional parameters for the 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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the job schedules in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobScheduleListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + Observable> listNextAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions); + + /** + * Lists all of the job schedules in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobScheduleListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + Observable, JobScheduleListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions); + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Jobs.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Jobs.java new file mode 100644 index 000000000000..5480d18ed9ac --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Jobs.java @@ -0,0 +1,1448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol; + +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.CloudJob; +import com.microsoft.azure.batch.protocol.models.DisableJobOption; +import com.microsoft.azure.batch.protocol.models.JobAddHeaders; +import com.microsoft.azure.batch.protocol.models.JobAddOptions; +import com.microsoft.azure.batch.protocol.models.JobAddParameter; +import com.microsoft.azure.batch.protocol.models.JobDeleteHeaders; +import com.microsoft.azure.batch.protocol.models.JobDeleteOptions; +import com.microsoft.azure.batch.protocol.models.JobDisableHeaders; +import com.microsoft.azure.batch.protocol.models.JobDisableOptions; +import com.microsoft.azure.batch.protocol.models.JobEnableHeaders; +import com.microsoft.azure.batch.protocol.models.JobEnableOptions; +import com.microsoft.azure.batch.protocol.models.JobGetAllLifetimeStatisticsHeaders; +import com.microsoft.azure.batch.protocol.models.JobGetAllLifetimeStatisticsOptions; +import com.microsoft.azure.batch.protocol.models.JobGetHeaders; +import com.microsoft.azure.batch.protocol.models.JobGetOptions; +import com.microsoft.azure.batch.protocol.models.JobGetTaskCountsHeaders; +import com.microsoft.azure.batch.protocol.models.JobGetTaskCountsOptions; +import com.microsoft.azure.batch.protocol.models.JobListFromJobScheduleHeaders; +import com.microsoft.azure.batch.protocol.models.JobListFromJobScheduleNextOptions; +import com.microsoft.azure.batch.protocol.models.JobListFromJobScheduleOptions; +import com.microsoft.azure.batch.protocol.models.JobListHeaders; +import com.microsoft.azure.batch.protocol.models.JobListNextOptions; +import com.microsoft.azure.batch.protocol.models.JobListOptions; +import com.microsoft.azure.batch.protocol.models.JobListPreparationAndReleaseTaskStatusHeaders; +import com.microsoft.azure.batch.protocol.models.JobListPreparationAndReleaseTaskStatusNextOptions; +import com.microsoft.azure.batch.protocol.models.JobListPreparationAndReleaseTaskStatusOptions; +import com.microsoft.azure.batch.protocol.models.JobPatchHeaders; +import com.microsoft.azure.batch.protocol.models.JobPatchOptions; +import com.microsoft.azure.batch.protocol.models.JobPatchParameter; +import com.microsoft.azure.batch.protocol.models.JobPreparationAndReleaseTaskExecutionInformation; +import com.microsoft.azure.batch.protocol.models.JobStatistics; +import com.microsoft.azure.batch.protocol.models.JobTerminateHeaders; +import com.microsoft.azure.batch.protocol.models.JobTerminateOptions; +import com.microsoft.azure.batch.protocol.models.JobUpdateHeaders; +import com.microsoft.azure.batch.protocol.models.JobUpdateOptions; +import com.microsoft.azure.batch.protocol.models.JobUpdateParameter; +import com.microsoft.azure.batch.protocol.models.TaskCounts; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Jobs. + */ +public interface Jobs { + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the JobStatistics object if successful. + */ + JobStatistics getAllLifetimeStatistics(); + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAllLifetimeStatisticsAsync(final ServiceCallback serviceCallback); + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStatistics object + */ + Observable getAllLifetimeStatisticsAsync(); + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStatistics object + */ + Observable> getAllLifetimeStatisticsWithServiceResponseAsync(); + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param jobGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the JobStatistics object if successful. + */ + JobStatistics getAllLifetimeStatistics(JobGetAllLifetimeStatisticsOptions jobGetAllLifetimeStatisticsOptions); + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param jobGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAllLifetimeStatisticsAsync(JobGetAllLifetimeStatisticsOptions jobGetAllLifetimeStatisticsOptions, final ServiceCallback serviceCallback); + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param jobGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStatistics object + */ + Observable getAllLifetimeStatisticsAsync(JobGetAllLifetimeStatisticsOptions jobGetAllLifetimeStatisticsOptions); + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param jobGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStatistics object + */ + Observable> getAllLifetimeStatisticsWithServiceResponseAsync(JobGetAllLifetimeStatisticsOptions jobGetAllLifetimeStatisticsOptions); + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String jobId); + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job 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 + */ + ServiceFuture deleteAsync(String jobId, final ServiceCallback serviceCallback); + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteAsync(String jobId); + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String jobId); + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @param jobDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String jobId, JobDeleteOptions jobDeleteOptions); + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @param jobDeleteOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteAsync(String jobId, JobDeleteOptions jobDeleteOptions, final ServiceCallback serviceCallback); + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @param jobDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteAsync(String jobId, JobDeleteOptions jobDeleteOptions); + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @param jobDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String jobId, JobDeleteOptions jobDeleteOptions); + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudJob object if successful. + */ + CloudJob get(String jobId); + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String jobId, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJob object + */ + Observable getAsync(String jobId); + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJob object + */ + Observable> getWithServiceResponseAsync(String jobId); + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @param jobGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudJob object if successful. + */ + CloudJob get(String jobId, JobGetOptions jobGetOptions); + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @param jobGetOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String jobId, JobGetOptions jobGetOptions, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @param jobGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJob object + */ + Observable getAsync(String jobId, JobGetOptions jobGetOptions); + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @param jobGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJob object + */ + Observable> getWithServiceResponseAsync(String jobId, JobGetOptions jobGetOptions); + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void patch(String jobId, JobPatchParameter jobPatchParameter); + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter 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 + */ + ServiceFuture patchAsync(String jobId, JobPatchParameter jobPatchParameter, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable patchAsync(String jobId, JobPatchParameter jobPatchParameter); + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> patchWithServiceResponseAsync(String jobId, JobPatchParameter jobPatchParameter); + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @param jobPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void patch(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions); + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @param jobPatchOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture patchAsync(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @param jobPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable patchAsync(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions); + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @param jobPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> patchWithServiceResponseAsync(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions); + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String jobId, JobUpdateParameter jobUpdateParameter); + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter 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 + */ + ServiceFuture updateAsync(String jobId, JobUpdateParameter jobUpdateParameter, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable updateAsync(String jobId, JobUpdateParameter jobUpdateParameter); + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> updateWithServiceResponseAsync(String jobId, JobUpdateParameter jobUpdateParameter); + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @param jobUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String jobId, JobUpdateParameter jobUpdateParameter, JobUpdateOptions jobUpdateOptions); + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @param jobUpdateOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateAsync(String jobId, JobUpdateParameter jobUpdateParameter, JobUpdateOptions jobUpdateOptions, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @param jobUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable updateAsync(String jobId, JobUpdateParameter jobUpdateParameter, JobUpdateOptions jobUpdateOptions); + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @param jobUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> updateWithServiceResponseAsync(String jobId, JobUpdateParameter jobUpdateParameter, JobUpdateOptions jobUpdateOptions); + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void disable(String jobId, DisableJobOption disableTasks); + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture disableAsync(String jobId, DisableJobOption disableTasks, final ServiceCallback serviceCallback); + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable disableAsync(String jobId, DisableJobOption disableTasks); + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> disableWithServiceResponseAsync(String jobId, DisableJobOption disableTasks); + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @param jobDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void disable(String jobId, DisableJobOption disableTasks, JobDisableOptions jobDisableOptions); + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @param jobDisableOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture disableAsync(String jobId, DisableJobOption disableTasks, JobDisableOptions jobDisableOptions, final ServiceCallback serviceCallback); + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @param jobDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable disableAsync(String jobId, DisableJobOption disableTasks, JobDisableOptions jobDisableOptions); + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @param jobDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> disableWithServiceResponseAsync(String jobId, DisableJobOption disableTasks, JobDisableOptions jobDisableOptions); + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void enable(String jobId); + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture enableAsync(String jobId, final ServiceCallback serviceCallback); + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable enableAsync(String jobId); + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> enableWithServiceResponseAsync(String jobId); + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @param jobEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void enable(String jobId, JobEnableOptions jobEnableOptions); + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @param jobEnableOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture enableAsync(String jobId, JobEnableOptions jobEnableOptions, final ServiceCallback serviceCallback); + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @param jobEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable enableAsync(String jobId, JobEnableOptions jobEnableOptions); + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @param jobEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> enableWithServiceResponseAsync(String jobId, JobEnableOptions jobEnableOptions); + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void terminate(String jobId); + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture terminateAsync(String jobId, final ServiceCallback serviceCallback); + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable terminateAsync(String jobId); + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> terminateWithServiceResponseAsync(String jobId); + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @param terminateReason The text you want to appear as the job's TerminateReason. The default is 'UserTerminate'. + * @param jobTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void terminate(String jobId, String terminateReason, JobTerminateOptions jobTerminateOptions); + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @param terminateReason The text you want to appear as the job's TerminateReason. The default is 'UserTerminate'. + * @param jobTerminateOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture terminateAsync(String jobId, String terminateReason, JobTerminateOptions jobTerminateOptions, final ServiceCallback serviceCallback); + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @param terminateReason The text you want to appear as the job's TerminateReason. The default is 'UserTerminate'. + * @param jobTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable terminateAsync(String jobId, String terminateReason, JobTerminateOptions jobTerminateOptions); + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @param terminateReason The text you want to appear as the job's TerminateReason. The default is 'UserTerminate'. + * @param jobTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> terminateWithServiceResponseAsync(String jobId, String terminateReason, JobTerminateOptions jobTerminateOptions); + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void add(JobAddParameter job); + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addAsync(JobAddParameter job, final ServiceCallback serviceCallback); + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addAsync(JobAddParameter job); + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addWithServiceResponseAsync(JobAddParameter job); + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @param jobAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void add(JobAddParameter job, JobAddOptions jobAddOptions); + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @param jobAddOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addAsync(JobAddParameter job, JobAddOptions jobAddOptions, final ServiceCallback serviceCallback); + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @param jobAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addAsync(JobAddParameter job, JobAddOptions jobAddOptions); + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @param jobAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addWithServiceResponseAsync(JobAddParameter job, JobAddOptions jobAddOptions); + + /** + * Lists all of the jobs in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + PagedList list(); + + /** + * Lists all of the jobs in the specified 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 + */ + ServiceFuture> listAsync(final ListOperationCallback serviceCallback); + + /** + * Lists all of the jobs in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable> listAsync(); + + /** + * Lists all of the jobs in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable, JobListHeaders>> listWithServiceResponseAsync(); + /** + * Lists all of the jobs in the specified account. + * + * @param jobListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + PagedList list(final JobListOptions jobListOptions); + + /** + * Lists all of the jobs in the specified account. + * + * @param jobListOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final JobListOptions jobListOptions, final ListOperationCallback serviceCallback); + + /** + * Lists all of the jobs in the specified account. + * + * @param jobListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable> listAsync(final JobListOptions jobListOptions); + + /** + * Lists all of the jobs in the specified account. + * + * @param jobListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable, JobListHeaders>> listWithServiceResponseAsync(final JobListOptions jobListOptions); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + PagedList listFromJobSchedule(final String jobScheduleId); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listFromJobScheduleAsync(final String jobScheduleId, final ListOperationCallback serviceCallback); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable> listFromJobScheduleAsync(final String jobScheduleId); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleWithServiceResponseAsync(final String jobScheduleId); + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @param jobListFromJobScheduleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + PagedList listFromJobSchedule(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @param jobListFromJobScheduleOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listFromJobScheduleAsync(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions, final ListOperationCallback serviceCallback); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @param jobListFromJobScheduleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable> listFromJobScheduleAsync(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @param jobListFromJobScheduleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleWithServiceResponseAsync(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<JobPreparationAndReleaseTaskExecutionInformation> object if successful. + */ + PagedList listPreparationAndReleaseTaskStatus(final String jobId); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listPreparationAndReleaseTaskStatusAsync(final String jobId, final ListOperationCallback serviceCallback); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + Observable> listPreparationAndReleaseTaskStatusAsync(final String jobId); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusWithServiceResponseAsync(final String jobId); + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @param jobListPreparationAndReleaseTaskStatusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<JobPreparationAndReleaseTaskExecutionInformation> object if successful. + */ + PagedList listPreparationAndReleaseTaskStatus(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @param jobListPreparationAndReleaseTaskStatusOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listPreparationAndReleaseTaskStatusAsync(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions, final ListOperationCallback serviceCallback); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @param jobListPreparationAndReleaseTaskStatusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + Observable> listPreparationAndReleaseTaskStatusAsync(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @param jobListPreparationAndReleaseTaskStatusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusWithServiceResponseAsync(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions); + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TaskCounts object if successful. + */ + TaskCounts getTaskCounts(String jobId); + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getTaskCountsAsync(String jobId, final ServiceCallback serviceCallback); + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskCounts object + */ + Observable getTaskCountsAsync(String jobId); + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskCounts object + */ + Observable> getTaskCountsWithServiceResponseAsync(String jobId); + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @param jobGetTaskCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TaskCounts object if successful. + */ + TaskCounts getTaskCounts(String jobId, JobGetTaskCountsOptions jobGetTaskCountsOptions); + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @param jobGetTaskCountsOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getTaskCountsAsync(String jobId, JobGetTaskCountsOptions jobGetTaskCountsOptions, final ServiceCallback serviceCallback); + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @param jobGetTaskCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskCounts object + */ + Observable getTaskCountsAsync(String jobId, JobGetTaskCountsOptions jobGetTaskCountsOptions); + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @param jobGetTaskCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskCounts object + */ + Observable> getTaskCountsWithServiceResponseAsync(String jobId, JobGetTaskCountsOptions jobGetTaskCountsOptions); + + /** + * Lists all of the jobs 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 BatchErrorException 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<CloudJob> object if successful. + */ + PagedList listNext(final String nextPageLink); + + /** + * Lists all of the jobs 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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the jobs 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<CloudJob> object + */ + Observable> listNextAsync(final String nextPageLink); + + /** + * Lists all of the jobs 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<CloudJob> object + */ + Observable, JobListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink); + /** + * Lists all of the jobs in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + PagedList listNext(final String nextPageLink, final JobListNextOptions jobListNextOptions); + + /** + * Lists all of the jobs in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListNextOptions Additional parameters for the 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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final JobListNextOptions jobListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the jobs in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable> listNextAsync(final String nextPageLink, final JobListNextOptions jobListNextOptions); + + /** + * Lists all of the jobs in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable, JobListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final JobListNextOptions jobListNextOptions); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + PagedList listFromJobScheduleNext(final String nextPageLink); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @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 + */ + ServiceFuture> listFromJobScheduleNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @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<CloudJob> object + */ + Observable> listFromJobScheduleNextAsync(final String nextPageLink); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @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<CloudJob> object + */ + Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleNextWithServiceResponseAsync(final String nextPageLink); + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListFromJobScheduleNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + PagedList listFromJobScheduleNext(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListFromJobScheduleNextOptions Additional parameters for the 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 + */ + ServiceFuture> listFromJobScheduleNextAsync(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListFromJobScheduleNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable> listFromJobScheduleNextAsync(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions); + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListFromJobScheduleNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleNextWithServiceResponseAsync(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<JobPreparationAndReleaseTaskExecutionInformation> object if successful. + */ + PagedList listPreparationAndReleaseTaskStatusNext(final String nextPageLink); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @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 + */ + ServiceFuture> listPreparationAndReleaseTaskStatusNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @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<JobPreparationAndReleaseTaskExecutionInformation> object + */ + Observable> listPreparationAndReleaseTaskStatusNextAsync(final String nextPageLink); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @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<JobPreparationAndReleaseTaskExecutionInformation> object + */ + Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(final String nextPageLink); + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<JobPreparationAndReleaseTaskExecutionInformation> object if successful. + */ + PagedList listPreparationAndReleaseTaskStatusNext(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the 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 + */ + ServiceFuture> listPreparationAndReleaseTaskStatusNextAsync(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + Observable> listPreparationAndReleaseTaskStatusNextAsync(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions); + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions); + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Pools.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Pools.java new file mode 100644 index 000000000000..b2ad786d2753 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Pools.java @@ -0,0 +1,1548 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol; + +import com.microsoft.azure.batch.protocol.models.AutoScaleRun; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.CloudPool; +import com.microsoft.azure.batch.protocol.models.NodeRemoveParameter; +import com.microsoft.azure.batch.protocol.models.PoolAddHeaders; +import com.microsoft.azure.batch.protocol.models.PoolAddOptions; +import com.microsoft.azure.batch.protocol.models.PoolAddParameter; +import com.microsoft.azure.batch.protocol.models.PoolDeleteHeaders; +import com.microsoft.azure.batch.protocol.models.PoolDeleteOptions; +import com.microsoft.azure.batch.protocol.models.PoolDisableAutoScaleHeaders; +import com.microsoft.azure.batch.protocol.models.PoolDisableAutoScaleOptions; +import com.microsoft.azure.batch.protocol.models.PoolEnableAutoScaleHeaders; +import com.microsoft.azure.batch.protocol.models.PoolEnableAutoScaleOptions; +import com.microsoft.azure.batch.protocol.models.PoolEnableAutoScaleParameter; +import com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleHeaders; +import com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleOptions; +import com.microsoft.azure.batch.protocol.models.PoolExistsHeaders; +import com.microsoft.azure.batch.protocol.models.PoolExistsOptions; +import com.microsoft.azure.batch.protocol.models.PoolGetAllLifetimeStatisticsHeaders; +import com.microsoft.azure.batch.protocol.models.PoolGetAllLifetimeStatisticsOptions; +import com.microsoft.azure.batch.protocol.models.PoolGetHeaders; +import com.microsoft.azure.batch.protocol.models.PoolGetOptions; +import com.microsoft.azure.batch.protocol.models.PoolListHeaders; +import com.microsoft.azure.batch.protocol.models.PoolListNextOptions; +import com.microsoft.azure.batch.protocol.models.PoolListOptions; +import com.microsoft.azure.batch.protocol.models.PoolListUsageMetricsHeaders; +import com.microsoft.azure.batch.protocol.models.PoolListUsageMetricsNextOptions; +import com.microsoft.azure.batch.protocol.models.PoolListUsageMetricsOptions; +import com.microsoft.azure.batch.protocol.models.PoolPatchHeaders; +import com.microsoft.azure.batch.protocol.models.PoolPatchOptions; +import com.microsoft.azure.batch.protocol.models.PoolPatchParameter; +import com.microsoft.azure.batch.protocol.models.PoolRemoveNodesHeaders; +import com.microsoft.azure.batch.protocol.models.PoolRemoveNodesOptions; +import com.microsoft.azure.batch.protocol.models.PoolResizeHeaders; +import com.microsoft.azure.batch.protocol.models.PoolResizeOptions; +import com.microsoft.azure.batch.protocol.models.PoolResizeParameter; +import com.microsoft.azure.batch.protocol.models.PoolStatistics; +import com.microsoft.azure.batch.protocol.models.PoolStopResizeHeaders; +import com.microsoft.azure.batch.protocol.models.PoolStopResizeOptions; +import com.microsoft.azure.batch.protocol.models.PoolUpdatePropertiesHeaders; +import com.microsoft.azure.batch.protocol.models.PoolUpdatePropertiesOptions; +import com.microsoft.azure.batch.protocol.models.PoolUpdatePropertiesParameter; +import com.microsoft.azure.batch.protocol.models.PoolUsageMetrics; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Pools. + */ +public interface Pools { + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolUsageMetrics> object if successful. + */ + PagedList listUsageMetrics(); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listUsageMetricsAsync(final ListOperationCallback serviceCallback); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + Observable> listUsageMetricsAsync(); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + Observable, PoolListUsageMetricsHeaders>> listUsageMetricsWithServiceResponseAsync(); + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param poolListUsageMetricsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolUsageMetrics> object if successful. + */ + PagedList listUsageMetrics(final PoolListUsageMetricsOptions poolListUsageMetricsOptions); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param poolListUsageMetricsOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listUsageMetricsAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions, final ListOperationCallback serviceCallback); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param poolListUsageMetricsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + Observable> listUsageMetricsAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param poolListUsageMetricsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + Observable, PoolListUsageMetricsHeaders>> listUsageMetricsWithServiceResponseAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions); + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PoolStatistics object if successful. + */ + PoolStatistics getAllLifetimeStatistics(); + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAllLifetimeStatisticsAsync(final ServiceCallback serviceCallback); + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PoolStatistics object + */ + Observable getAllLifetimeStatisticsAsync(); + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PoolStatistics object + */ + Observable> getAllLifetimeStatisticsWithServiceResponseAsync(); + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PoolStatistics object if successful. + */ + PoolStatistics getAllLifetimeStatistics(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions); + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAllLifetimeStatisticsAsync(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions, final ServiceCallback serviceCallback); + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PoolStatistics object + */ + Observable getAllLifetimeStatisticsAsync(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions); + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PoolStatistics object + */ + Observable> getAllLifetimeStatisticsWithServiceResponseAsync(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions); + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void add(PoolAddParameter pool); + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addAsync(PoolAddParameter pool, final ServiceCallback serviceCallback); + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addAsync(PoolAddParameter pool); + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addWithServiceResponseAsync(PoolAddParameter pool); + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @param poolAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void add(PoolAddParameter pool, PoolAddOptions poolAddOptions); + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @param poolAddOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions, final ServiceCallback serviceCallback); + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @param poolAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions); + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @param poolAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addWithServiceResponseAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions); + + /** + * Lists all of the pools in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudPool> object if successful. + */ + PagedList list(); + + /** + * Lists all of the pools in the specified 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 + */ + ServiceFuture> listAsync(final ListOperationCallback serviceCallback); + + /** + * Lists all of the pools in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + Observable> listAsync(); + + /** + * Lists all of the pools in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + Observable, PoolListHeaders>> listWithServiceResponseAsync(); + /** + * Lists all of the pools in the specified account. + * + * @param poolListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudPool> object if successful. + */ + PagedList list(final PoolListOptions poolListOptions); + + /** + * Lists all of the pools in the specified account. + * + * @param poolListOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final PoolListOptions poolListOptions, final ListOperationCallback serviceCallback); + + /** + * Lists all of the pools in the specified account. + * + * @param poolListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + Observable> listAsync(final PoolListOptions poolListOptions); + + /** + * Lists all of the pools in the specified account. + * + * @param poolListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + Observable, PoolListHeaders>> listWithServiceResponseAsync(final PoolListOptions poolListOptions); + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String poolId); + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool 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 + */ + ServiceFuture deleteAsync(String poolId, final ServiceCallback serviceCallback); + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteAsync(String poolId); + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String poolId); + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @param poolDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String poolId, PoolDeleteOptions poolDeleteOptions); + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @param poolDeleteOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteAsync(String poolId, PoolDeleteOptions poolDeleteOptions, final ServiceCallback serviceCallback); + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @param poolDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteAsync(String poolId, PoolDeleteOptions poolDeleteOptions); + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @param poolDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String poolId, PoolDeleteOptions poolDeleteOptions); + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + boolean exists(String poolId); + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture existsAsync(String poolId, final ServiceCallback serviceCallback); + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the boolean object + */ + Observable existsAsync(String poolId); + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the boolean object + */ + Observable> existsWithServiceResponseAsync(String poolId); + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @param poolExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + boolean exists(String poolId, PoolExistsOptions poolExistsOptions); + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @param poolExistsOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture existsAsync(String poolId, PoolExistsOptions poolExistsOptions, final ServiceCallback serviceCallback); + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @param poolExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the boolean object + */ + Observable existsAsync(String poolId, PoolExistsOptions poolExistsOptions); + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @param poolExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the boolean object + */ + Observable> existsWithServiceResponseAsync(String poolId, PoolExistsOptions poolExistsOptions); + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudPool object if successful. + */ + CloudPool get(String poolId); + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String poolId, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudPool object + */ + Observable getAsync(String poolId); + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudPool object + */ + Observable> getWithServiceResponseAsync(String poolId); + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @param poolGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudPool object if successful. + */ + CloudPool get(String poolId, PoolGetOptions poolGetOptions); + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @param poolGetOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String poolId, PoolGetOptions poolGetOptions, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @param poolGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudPool object + */ + Observable getAsync(String poolId, PoolGetOptions poolGetOptions); + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @param poolGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudPool object + */ + Observable> getWithServiceResponseAsync(String poolId, PoolGetOptions poolGetOptions); + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void patch(String poolId, PoolPatchParameter poolPatchParameter); + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter 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 + */ + ServiceFuture patchAsync(String poolId, PoolPatchParameter poolPatchParameter, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable patchAsync(String poolId, PoolPatchParameter poolPatchParameter); + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> patchWithServiceResponseAsync(String poolId, PoolPatchParameter poolPatchParameter); + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @param poolPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void patch(String poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions); + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @param poolPatchOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture patchAsync(String poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @param poolPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable patchAsync(String poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions); + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @param poolPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> patchWithServiceResponseAsync(String poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions); + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void disableAutoScale(String poolId); + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture disableAutoScaleAsync(String poolId, final ServiceCallback serviceCallback); + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable disableAutoScaleAsync(String poolId); + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> disableAutoScaleWithServiceResponseAsync(String poolId); + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @param poolDisableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void disableAutoScale(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions); + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @param poolDisableAutoScaleOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture disableAutoScaleAsync(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions, final ServiceCallback serviceCallback); + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @param poolDisableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable disableAutoScaleAsync(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions); + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @param poolDisableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> disableAutoScaleWithServiceResponseAsync(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions); + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void enableAutoScale(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter); + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter 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 + */ + ServiceFuture enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, final ServiceCallback serviceCallback); + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter); + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> enableAutoScaleWithServiceResponseAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter); + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @param poolEnableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void enableAutoScale(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, PoolEnableAutoScaleOptions poolEnableAutoScaleOptions); + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @param poolEnableAutoScaleOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, PoolEnableAutoScaleOptions poolEnableAutoScaleOptions, final ServiceCallback serviceCallback); + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @param poolEnableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, PoolEnableAutoScaleOptions poolEnableAutoScaleOptions); + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @param poolEnableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> enableAutoScaleWithServiceResponseAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, PoolEnableAutoScaleOptions poolEnableAutoScaleOptions); + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AutoScaleRun object if successful. + */ + AutoScaleRun evaluateAutoScale(String poolId, String autoScaleFormula); + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture evaluateAutoScaleAsync(String poolId, String autoScaleFormula, final ServiceCallback serviceCallback); + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoScaleRun object + */ + Observable evaluateAutoScaleAsync(String poolId, String autoScaleFormula); + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoScaleRun object + */ + Observable> evaluateAutoScaleWithServiceResponseAsync(String poolId, String autoScaleFormula); + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @param poolEvaluateAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AutoScaleRun object if successful. + */ + AutoScaleRun evaluateAutoScale(String poolId, String autoScaleFormula, PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions); + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @param poolEvaluateAutoScaleOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture evaluateAutoScaleAsync(String poolId, String autoScaleFormula, PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions, final ServiceCallback serviceCallback); + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @param poolEvaluateAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoScaleRun object + */ + Observable evaluateAutoScaleAsync(String poolId, String autoScaleFormula, PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions); + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @param poolEvaluateAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoScaleRun object + */ + Observable> evaluateAutoScaleWithServiceResponseAsync(String poolId, String autoScaleFormula, PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions); + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void resize(String poolId, PoolResizeParameter poolResizeParameter); + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter 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 + */ + ServiceFuture resizeAsync(String poolId, PoolResizeParameter poolResizeParameter, final ServiceCallback serviceCallback); + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable resizeAsync(String poolId, PoolResizeParameter poolResizeParameter); + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> resizeWithServiceResponseAsync(String poolId, PoolResizeParameter poolResizeParameter); + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @param poolResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void resize(String poolId, PoolResizeParameter poolResizeParameter, PoolResizeOptions poolResizeOptions); + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @param poolResizeOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture resizeAsync(String poolId, PoolResizeParameter poolResizeParameter, PoolResizeOptions poolResizeOptions, final ServiceCallback serviceCallback); + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @param poolResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable resizeAsync(String poolId, PoolResizeParameter poolResizeParameter, PoolResizeOptions poolResizeOptions); + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @param poolResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> resizeWithServiceResponseAsync(String poolId, PoolResizeParameter poolResizeParameter, PoolResizeOptions poolResizeOptions); + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void stopResize(String poolId); + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture stopResizeAsync(String poolId, final ServiceCallback serviceCallback); + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable stopResizeAsync(String poolId); + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> stopResizeWithServiceResponseAsync(String poolId); + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @param poolStopResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void stopResize(String poolId, PoolStopResizeOptions poolStopResizeOptions); + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @param poolStopResizeOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture stopResizeAsync(String poolId, PoolStopResizeOptions poolStopResizeOptions, final ServiceCallback serviceCallback); + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @param poolStopResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable stopResizeAsync(String poolId, PoolStopResizeOptions poolStopResizeOptions); + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @param poolStopResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> stopResizeWithServiceResponseAsync(String poolId, PoolStopResizeOptions poolStopResizeOptions); + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void updateProperties(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter); + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter 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 + */ + ServiceFuture updatePropertiesAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable updatePropertiesAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter); + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> updatePropertiesWithServiceResponseAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter); + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @param poolUpdatePropertiesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void updateProperties(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, PoolUpdatePropertiesOptions poolUpdatePropertiesOptions); + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @param poolUpdatePropertiesOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updatePropertiesAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, PoolUpdatePropertiesOptions poolUpdatePropertiesOptions, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @param poolUpdatePropertiesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable updatePropertiesAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, PoolUpdatePropertiesOptions poolUpdatePropertiesOptions); + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @param poolUpdatePropertiesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> updatePropertiesWithServiceResponseAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, PoolUpdatePropertiesOptions poolUpdatePropertiesOptions); + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void removeNodes(String poolId, NodeRemoveParameter nodeRemoveParameter); + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter 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 + */ + ServiceFuture removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, final ServiceCallback serviceCallback); + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter); + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> removeNodesWithServiceResponseAsync(String poolId, NodeRemoveParameter nodeRemoveParameter); + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @param poolRemoveNodesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void removeNodes(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions); + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @param poolRemoveNodesOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions, final ServiceCallback serviceCallback); + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @param poolRemoveNodesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions); + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @param poolRemoveNodesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> removeNodesWithServiceResponseAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolUsageMetrics> object if successful. + */ + PagedList listUsageMetricsNext(final String nextPageLink); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @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 + */ + ServiceFuture> listUsageMetricsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @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<PoolUsageMetrics> object + */ + Observable> listUsageMetricsNextAsync(final String nextPageLink); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @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<PoolUsageMetrics> object + */ + Observable, PoolListUsageMetricsHeaders>> listUsageMetricsNextWithServiceResponseAsync(final String nextPageLink); + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListUsageMetricsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolUsageMetrics> object if successful. + */ + PagedList listUsageMetricsNext(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListUsageMetricsNextOptions Additional parameters for the 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 + */ + ServiceFuture> listUsageMetricsNextAsync(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListUsageMetricsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + Observable> listUsageMetricsNextAsync(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions); + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListUsageMetricsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + Observable, PoolListUsageMetricsHeaders>> listUsageMetricsNextWithServiceResponseAsync(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions); + + /** + * Lists all of the pools 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 BatchErrorException 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<CloudPool> object if successful. + */ + PagedList listNext(final String nextPageLink); + + /** + * Lists all of the pools 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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the pools 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<CloudPool> object + */ + Observable> listNextAsync(final String nextPageLink); + + /** + * Lists all of the pools 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<CloudPool> object + */ + Observable, PoolListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink); + /** + * Lists all of the pools in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudPool> object if successful. + */ + PagedList listNext(final String nextPageLink, final PoolListNextOptions poolListNextOptions); + + /** + * Lists all of the pools in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListNextOptions Additional parameters for the 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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final PoolListNextOptions poolListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the pools in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + Observable> listNextAsync(final String nextPageLink, final PoolListNextOptions poolListNextOptions); + + /** + * Lists all of the pools in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + Observable, PoolListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final PoolListNextOptions poolListNextOptions); + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Tasks.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Tasks.java new file mode 100644 index 000000000000..9605cbef9145 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/Tasks.java @@ -0,0 +1,989 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol; + +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.CloudTask; +import com.microsoft.azure.batch.protocol.models.CloudTaskListSubtasksResult; +import com.microsoft.azure.batch.protocol.models.TaskAddCollectionHeaders; +import com.microsoft.azure.batch.protocol.models.TaskAddCollectionOptions; +import com.microsoft.azure.batch.protocol.models.TaskAddCollectionResult; +import com.microsoft.azure.batch.protocol.models.TaskAddHeaders; +import com.microsoft.azure.batch.protocol.models.TaskAddOptions; +import com.microsoft.azure.batch.protocol.models.TaskAddParameter; +import com.microsoft.azure.batch.protocol.models.TaskConstraints; +import com.microsoft.azure.batch.protocol.models.TaskDeleteHeaders; +import com.microsoft.azure.batch.protocol.models.TaskDeleteOptions; +import com.microsoft.azure.batch.protocol.models.TaskGetHeaders; +import com.microsoft.azure.batch.protocol.models.TaskGetOptions; +import com.microsoft.azure.batch.protocol.models.TaskListHeaders; +import com.microsoft.azure.batch.protocol.models.TaskListNextOptions; +import com.microsoft.azure.batch.protocol.models.TaskListOptions; +import com.microsoft.azure.batch.protocol.models.TaskListSubtasksHeaders; +import com.microsoft.azure.batch.protocol.models.TaskListSubtasksOptions; +import com.microsoft.azure.batch.protocol.models.TaskReactivateHeaders; +import com.microsoft.azure.batch.protocol.models.TaskReactivateOptions; +import com.microsoft.azure.batch.protocol.models.TaskTerminateHeaders; +import com.microsoft.azure.batch.protocol.models.TaskTerminateOptions; +import com.microsoft.azure.batch.protocol.models.TaskUpdateHeaders; +import com.microsoft.azure.batch.protocol.models.TaskUpdateOptions; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Tasks. + */ +public interface Tasks { + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void add(String jobId, TaskAddParameter task); + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addAsync(String jobId, TaskAddParameter task, final ServiceCallback serviceCallback); + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addAsync(String jobId, TaskAddParameter task); + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addWithServiceResponseAsync(String jobId, TaskAddParameter task); + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @param taskAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void add(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions); + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @param taskAddOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addAsync(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions, final ServiceCallback serviceCallback); + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @param taskAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable addAsync(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions); + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @param taskAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> addWithServiceResponseAsync(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudTask> object if successful. + */ + PagedList list(final String jobId); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final String jobId, final ListOperationCallback serviceCallback); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + Observable> listAsync(final String jobId); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + Observable, TaskListHeaders>> listWithServiceResponseAsync(final String jobId); + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @param taskListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudTask> object if successful. + */ + PagedList list(final String jobId, final TaskListOptions taskListOptions); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @param taskListOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final String jobId, final TaskListOptions taskListOptions, final ListOperationCallback serviceCallback); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @param taskListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + Observable> listAsync(final String jobId, final TaskListOptions taskListOptions); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @param taskListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + Observable, TaskListHeaders>> listWithServiceResponseAsync(final String jobId, final TaskListOptions taskListOptions); + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TaskAddCollectionResult object if successful. + */ + TaskAddCollectionResult addCollection(String jobId, List value); + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addCollectionAsync(String jobId, List value, final ServiceCallback serviceCallback); + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskAddCollectionResult object + */ + Observable addCollectionAsync(String jobId, List value); + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskAddCollectionResult object + */ + Observable> addCollectionWithServiceResponseAsync(String jobId, List value); + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @param taskAddCollectionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TaskAddCollectionResult object if successful. + */ + TaskAddCollectionResult addCollection(String jobId, List value, TaskAddCollectionOptions taskAddCollectionOptions); + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @param taskAddCollectionOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addCollectionAsync(String jobId, List value, TaskAddCollectionOptions taskAddCollectionOptions, final ServiceCallback serviceCallback); + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @param taskAddCollectionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskAddCollectionResult object + */ + Observable addCollectionAsync(String jobId, List value, TaskAddCollectionOptions taskAddCollectionOptions); + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @param taskAddCollectionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskAddCollectionResult object + */ + Observable> addCollectionWithServiceResponseAsync(String jobId, List value, TaskAddCollectionOptions taskAddCollectionOptions); + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String jobId, String taskId); + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task 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 + */ + ServiceFuture deleteAsync(String jobId, String taskId, final ServiceCallback serviceCallback); + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteAsync(String jobId, String taskId); + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String jobId, String taskId); + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @param taskDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String jobId, String taskId, TaskDeleteOptions taskDeleteOptions); + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @param taskDeleteOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteAsync(String jobId, String taskId, TaskDeleteOptions taskDeleteOptions, final ServiceCallback serviceCallback); + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @param taskDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable deleteAsync(String jobId, String taskId, TaskDeleteOptions taskDeleteOptions); + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @param taskDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String jobId, String taskId, TaskDeleteOptions taskDeleteOptions); + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudTask object if successful. + */ + CloudTask get(String jobId, String taskId); + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String jobId, String taskId, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTask object + */ + Observable getAsync(String jobId, String taskId); + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTask object + */ + Observable> getWithServiceResponseAsync(String jobId, String taskId); + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @param taskGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudTask object if successful. + */ + CloudTask get(String jobId, String taskId, TaskGetOptions taskGetOptions); + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @param taskGetOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String jobId, String taskId, TaskGetOptions taskGetOptions, final ServiceCallback serviceCallback); + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @param taskGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTask object + */ + Observable getAsync(String jobId, String taskId, TaskGetOptions taskGetOptions); + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @param taskGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTask object + */ + Observable> getWithServiceResponseAsync(String jobId, String taskId, TaskGetOptions taskGetOptions); + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String jobId, String taskId); + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to 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 + */ + ServiceFuture updateAsync(String jobId, String taskId, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable updateAsync(String jobId, String taskId); + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> updateWithServiceResponseAsync(String jobId, String taskId); + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @param constraints Constraints that apply to this task. If omitted, the task is given the default constraints. For multi-instance tasks, updating the retention time applies only to the primary task and not subtasks. + * @param taskUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String jobId, String taskId, TaskConstraints constraints, TaskUpdateOptions taskUpdateOptions); + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @param constraints Constraints that apply to this task. If omitted, the task is given the default constraints. For multi-instance tasks, updating the retention time applies only to the primary task and not subtasks. + * @param taskUpdateOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateAsync(String jobId, String taskId, TaskConstraints constraints, TaskUpdateOptions taskUpdateOptions, final ServiceCallback serviceCallback); + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @param constraints Constraints that apply to this task. If omitted, the task is given the default constraints. For multi-instance tasks, updating the retention time applies only to the primary task and not subtasks. + * @param taskUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable updateAsync(String jobId, String taskId, TaskConstraints constraints, TaskUpdateOptions taskUpdateOptions); + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @param constraints Constraints that apply to this task. If omitted, the task is given the default constraints. For multi-instance tasks, updating the retention time applies only to the primary task and not subtasks. + * @param taskUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> updateWithServiceResponseAsync(String jobId, String taskId, TaskConstraints constraints, TaskUpdateOptions taskUpdateOptions); + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudTaskListSubtasksResult object if successful. + */ + CloudTaskListSubtasksResult listSubtasks(String jobId, String taskId); + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture listSubtasksAsync(String jobId, String taskId, final ServiceCallback serviceCallback); + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTaskListSubtasksResult object + */ + Observable listSubtasksAsync(String jobId, String taskId); + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTaskListSubtasksResult object + */ + Observable> listSubtasksWithServiceResponseAsync(String jobId, String taskId); + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @param taskListSubtasksOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudTaskListSubtasksResult object if successful. + */ + CloudTaskListSubtasksResult listSubtasks(String jobId, String taskId, TaskListSubtasksOptions taskListSubtasksOptions); + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @param taskListSubtasksOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture listSubtasksAsync(String jobId, String taskId, TaskListSubtasksOptions taskListSubtasksOptions, final ServiceCallback serviceCallback); + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @param taskListSubtasksOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTaskListSubtasksResult object + */ + Observable listSubtasksAsync(String jobId, String taskId, TaskListSubtasksOptions taskListSubtasksOptions); + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @param taskListSubtasksOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTaskListSubtasksResult object + */ + Observable> listSubtasksWithServiceResponseAsync(String jobId, String taskId, TaskListSubtasksOptions taskListSubtasksOptions); + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void terminate(String jobId, String taskId); + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture terminateAsync(String jobId, String taskId, final ServiceCallback serviceCallback); + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable terminateAsync(String jobId, String taskId); + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> terminateWithServiceResponseAsync(String jobId, String taskId); + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @param taskTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void terminate(String jobId, String taskId, TaskTerminateOptions taskTerminateOptions); + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @param taskTerminateOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture terminateAsync(String jobId, String taskId, TaskTerminateOptions taskTerminateOptions, final ServiceCallback serviceCallback); + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @param taskTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable terminateAsync(String jobId, String taskId, TaskTerminateOptions taskTerminateOptions); + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @param taskTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> terminateWithServiceResponseAsync(String jobId, String taskId, TaskTerminateOptions taskTerminateOptions); + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void reactivate(String jobId, String taskId); + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture reactivateAsync(String jobId, String taskId, final ServiceCallback serviceCallback); + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable reactivateAsync(String jobId, String taskId); + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> reactivateWithServiceResponseAsync(String jobId, String taskId); + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @param taskReactivateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void reactivate(String jobId, String taskId, TaskReactivateOptions taskReactivateOptions); + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @param taskReactivateOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture reactivateAsync(String jobId, String taskId, TaskReactivateOptions taskReactivateOptions, final ServiceCallback serviceCallback); + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @param taskReactivateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable reactivateAsync(String jobId, String taskId, TaskReactivateOptions taskReactivateOptions); + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @param taskReactivateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> reactivateWithServiceResponseAsync(String jobId, String taskId, TaskReactivateOptions taskReactivateOptions); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudTask> object if successful. + */ + PagedList listNext(final String nextPageLink); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @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<CloudTask> object + */ + Observable> listNextAsync(final String nextPageLink); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @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<CloudTask> object + */ + Observable, TaskListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink); + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param taskListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudTask> object if successful. + */ + PagedList listNext(final String nextPageLink, final TaskListNextOptions taskListNextOptions); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param taskListNextOptions Additional parameters for the 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 + */ + ServiceFuture> listNextAsync(final String nextPageLink, final TaskListNextOptions taskListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param taskListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + Observable> listNextAsync(final String nextPageLink, final TaskListNextOptions taskListNextOptions); + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param taskListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + Observable, TaskListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final TaskListNextOptions taskListNextOptions); + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java new file mode 100644 index 000000000000..3231fa30032b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java @@ -0,0 +1,1127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.batch.protocol.Accounts; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusHeaders; +import com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusNextOptions; +import com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusOptions; +import com.microsoft.azure.batch.protocol.models.AccountListPoolNodeCountsHeaders; +import com.microsoft.azure.batch.protocol.models.AccountListPoolNodeCountsNextOptions; +import com.microsoft.azure.batch.protocol.models.AccountListPoolNodeCountsOptions; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.NodeAgentSku; +import com.microsoft.azure.batch.protocol.models.PageImpl; +import com.microsoft.azure.batch.protocol.models.PoolNodeCounts; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.DateTimeRfc1123; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 Accounts. + */ +public class AccountsImpl implements Accounts { + /** The Retrofit service to perform REST calls. */ + private AccountsService service; + /** The service client containing this operation class. */ + private BatchServiceClientImpl client; + + /** + * Initializes an instance of AccountsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AccountsImpl(Retrofit retrofit, BatchServiceClientImpl client) { + this.service = retrofit.create(AccountsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Accounts to be + * used by Retrofit to perform actually REST calls. + */ + interface AccountsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Accounts listNodeAgentSkus" }) + @GET("nodeagentskus") + Observable> listNodeAgentSkus(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Accounts listPoolNodeCounts" }) + @GET("nodecounts") + Observable> listPoolNodeCounts(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Accounts listNodeAgentSkusNext" }) + @GET + Observable> listNodeAgentSkusNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Accounts listPoolNodeCountsNext" }) + @GET + Observable> listPoolNodeCountsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeAgentSku> object if successful. + */ + public PagedList listNodeAgentSkus() { + ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> response = listNodeAgentSkusSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNodeAgentSkusNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @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> listNodeAgentSkusAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listNodeAgentSkusSinglePageAsync(), + new Func1, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(String nextPageLink) { + return listNodeAgentSkusNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + public Observable> listNodeAgentSkusAsync() { + return listNodeAgentSkusWithServiceResponseAsync() + .map(new Func1, AccountListNodeAgentSkusHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + public Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusWithServiceResponseAsync() { + return listNodeAgentSkusSinglePageAsync() + .concatMap(new Func1, AccountListNodeAgentSkusHeaders>, Observable, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNodeAgentSkusNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeAgentSku> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusSinglePageAsync() { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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 AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions = null; + String filter = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listNodeAgentSkus(this.client.apiVersion(), this.client.acceptLanguage(), filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> result = listNodeAgentSkusDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param accountListNodeAgentSkusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeAgentSku> object if successful. + */ + public PagedList listNodeAgentSkus(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions) { + ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> response = listNodeAgentSkusSinglePageAsync(accountListNodeAgentSkusOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions = null; + if (accountListNodeAgentSkusOptions != null) { + accountListNodeAgentSkusNextOptions = new AccountListNodeAgentSkusNextOptions(); + accountListNodeAgentSkusNextOptions.withClientRequestId(accountListNodeAgentSkusOptions.clientRequestId()); + accountListNodeAgentSkusNextOptions.withReturnClientRequestId(accountListNodeAgentSkusOptions.returnClientRequestId()); + accountListNodeAgentSkusNextOptions.withOcpDate(accountListNodeAgentSkusOptions.ocpDate()); + } + return listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param accountListNodeAgentSkusOptions Additional parameters for the operation + * @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> listNodeAgentSkusAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listNodeAgentSkusSinglePageAsync(accountListNodeAgentSkusOptions), + new Func1, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(String nextPageLink) { + AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions = null; + if (accountListNodeAgentSkusOptions != null) { + accountListNodeAgentSkusNextOptions = new AccountListNodeAgentSkusNextOptions(); + accountListNodeAgentSkusNextOptions.withClientRequestId(accountListNodeAgentSkusOptions.clientRequestId()); + accountListNodeAgentSkusNextOptions.withReturnClientRequestId(accountListNodeAgentSkusOptions.returnClientRequestId()); + accountListNodeAgentSkusNextOptions.withOcpDate(accountListNodeAgentSkusOptions.ocpDate()); + } + return listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param accountListNodeAgentSkusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + public Observable> listNodeAgentSkusAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions) { + return listNodeAgentSkusWithServiceResponseAsync(accountListNodeAgentSkusOptions) + .map(new Func1, AccountListNodeAgentSkusHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param accountListNodeAgentSkusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + public Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusWithServiceResponseAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions) { + return listNodeAgentSkusSinglePageAsync(accountListNodeAgentSkusOptions) + .concatMap(new Func1, AccountListNodeAgentSkusHeaders>, Observable, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions = null; + if (accountListNodeAgentSkusOptions != null) { + accountListNodeAgentSkusNextOptions = new AccountListNodeAgentSkusNextOptions(); + accountListNodeAgentSkusNextOptions.withClientRequestId(accountListNodeAgentSkusOptions.clientRequestId()); + accountListNodeAgentSkusNextOptions.withReturnClientRequestId(accountListNodeAgentSkusOptions.returnClientRequestId()); + accountListNodeAgentSkusNextOptions.withOcpDate(accountListNodeAgentSkusOptions.ocpDate()); + } + return Observable.just(page).concatWith(listNodeAgentSkusNextWithServiceResponseAsync(nextPageLink, accountListNodeAgentSkusNextOptions)); + } + }); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> * @param accountListNodeAgentSkusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeAgentSku> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusSinglePageAsync(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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(accountListNodeAgentSkusOptions); + String filter = null; + if (accountListNodeAgentSkusOptions != null) { + filter = accountListNodeAgentSkusOptions.filter(); + } + Integer maxResults = null; + if (accountListNodeAgentSkusOptions != null) { + maxResults = accountListNodeAgentSkusOptions.maxResults(); + } + Integer timeout = null; + if (accountListNodeAgentSkusOptions != null) { + timeout = accountListNodeAgentSkusOptions.timeout(); + } + UUID clientRequestId = null; + if (accountListNodeAgentSkusOptions != null) { + clientRequestId = accountListNodeAgentSkusOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (accountListNodeAgentSkusOptions != null) { + returnClientRequestId = accountListNodeAgentSkusOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (accountListNodeAgentSkusOptions != null) { + ocpDate = accountListNodeAgentSkusOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listNodeAgentSkus(this.client.apiVersion(), this.client.acceptLanguage(), filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> result = listNodeAgentSkusDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> listNodeAgentSkusDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, AccountListNodeAgentSkusHeaders.class); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolNodeCounts> object if successful. + */ + public PagedList listPoolNodeCounts() { + ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> response = listPoolNodeCountsSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPoolNodeCountsNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @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> listPoolNodeCountsAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listPoolNodeCountsSinglePageAsync(), + new Func1, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) { + return listPoolNodeCountsNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + public Observable> listPoolNodeCountsAsync() { + return listPoolNodeCountsWithServiceResponseAsync() + .map(new Func1, AccountListPoolNodeCountsHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> response) { + return response.body(); + } + }); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + public Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsWithServiceResponseAsync() { + return listPoolNodeCountsSinglePageAsync() + .concatMap(new Func1, AccountListPoolNodeCountsHeaders>, Observable, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listPoolNodeCountsNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PoolNodeCounts> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsSinglePageAsync() { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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 AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions = null; + String filter = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listPoolNodeCounts(this.client.apiVersion(), this.client.acceptLanguage(), filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> result = listPoolNodeCountsDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param accountListPoolNodeCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolNodeCounts> object if successful. + */ + public PagedList listPoolNodeCounts(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions) { + ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> response = listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null; + if (accountListPoolNodeCountsOptions != null) { + accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions(); + accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId()); + accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId()); + accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate()); + } + return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param accountListPoolNodeCountsOptions Additional parameters for the operation + * @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> listPoolNodeCountsAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions), + new Func1, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) { + AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null; + if (accountListPoolNodeCountsOptions != null) { + accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions(); + accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId()); + accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId()); + accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate()); + } + return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions); + } + }, + serviceCallback); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param accountListPoolNodeCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + public Observable> listPoolNodeCountsAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions) { + return listPoolNodeCountsWithServiceResponseAsync(accountListPoolNodeCountsOptions) + .map(new Func1, AccountListPoolNodeCountsHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> response) { + return response.body(); + } + }); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param accountListPoolNodeCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + public Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsWithServiceResponseAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions) { + return listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions) + .concatMap(new Func1, AccountListPoolNodeCountsHeaders>, Observable, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null; + if (accountListPoolNodeCountsOptions != null) { + accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions(); + accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId()); + accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId()); + accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate()); + } + return Observable.just(page).concatWith(listPoolNodeCountsNextWithServiceResponseAsync(nextPageLink, accountListPoolNodeCountsNextOptions)); + } + }); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> * @param accountListPoolNodeCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PoolNodeCounts> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsSinglePageAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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(accountListPoolNodeCountsOptions); + String filter = null; + if (accountListPoolNodeCountsOptions != null) { + filter = accountListPoolNodeCountsOptions.filter(); + } + Integer maxResults = null; + if (accountListPoolNodeCountsOptions != null) { + maxResults = accountListPoolNodeCountsOptions.maxResults(); + } + Integer timeout = null; + if (accountListPoolNodeCountsOptions != null) { + timeout = accountListPoolNodeCountsOptions.timeout(); + } + UUID clientRequestId = null; + if (accountListPoolNodeCountsOptions != null) { + clientRequestId = accountListPoolNodeCountsOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (accountListPoolNodeCountsOptions != null) { + returnClientRequestId = accountListPoolNodeCountsOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (accountListPoolNodeCountsOptions != null) { + ocpDate = accountListPoolNodeCountsOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listPoolNodeCounts(this.client.apiVersion(), this.client.acceptLanguage(), filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> result = listPoolNodeCountsDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> listPoolNodeCountsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, AccountListPoolNodeCountsHeaders.class); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeAgentSku> object if successful. + */ + public PagedList listNodeAgentSkusNext(final String nextPageLink) { + ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> response = listNodeAgentSkusNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNodeAgentSkusNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @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> listNodeAgentSkusNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listNodeAgentSkusNextSinglePageAsync(nextPageLink), + new Func1, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(String nextPageLink) { + return listNodeAgentSkusNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @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<NodeAgentSku> object + */ + public Observable> listNodeAgentSkusNextAsync(final String nextPageLink) { + return listNodeAgentSkusNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, AccountListNodeAgentSkusHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @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<NodeAgentSku> object + */ + public Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusNextWithServiceResponseAsync(final String nextPageLink) { + return listNodeAgentSkusNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, AccountListNodeAgentSkusHeaders>, Observable, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNodeAgentSkusNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeAgentSku> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNodeAgentSkusNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> result = listNodeAgentSkusNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListNodeAgentSkusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeAgentSku> object if successful. + */ + public PagedList listNodeAgentSkusNext(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions) { + ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> response = listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListNodeAgentSkusNextOptions Additional parameters for the 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> listNodeAgentSkusNextAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions), + new Func1, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(String nextPageLink) { + return listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListNodeAgentSkusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + public Observable> listNodeAgentSkusNextAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions) { + return listNodeAgentSkusNextWithServiceResponseAsync(nextPageLink, accountListNodeAgentSkusNextOptions) + .map(new Func1, AccountListNodeAgentSkusHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListNodeAgentSkusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeAgentSku> object + */ + public Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusNextWithServiceResponseAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions) { + return listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions) + .concatMap(new Func1, AccountListNodeAgentSkusHeaders>, Observable, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNodeAgentSkusNextWithServiceResponseAsync(nextPageLink, accountListNodeAgentSkusNextOptions)); + } + }); + } + + /** + * Lists all node agent SKUs supported by the Azure Batch service. + * + ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> * @param accountListNodeAgentSkusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeAgentSku> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusNextSinglePageAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(accountListNodeAgentSkusNextOptions); + UUID clientRequestId = null; + if (accountListNodeAgentSkusNextOptions != null) { + clientRequestId = accountListNodeAgentSkusNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (accountListNodeAgentSkusNextOptions != null) { + returnClientRequestId = accountListNodeAgentSkusNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (accountListNodeAgentSkusNextOptions != null) { + ocpDate = accountListNodeAgentSkusNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNodeAgentSkusNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, AccountListNodeAgentSkusHeaders>>>() { + @Override + public Observable, AccountListNodeAgentSkusHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> result = listNodeAgentSkusNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, AccountListNodeAgentSkusHeaders> listNodeAgentSkusNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, AccountListNodeAgentSkusHeaders.class); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolNodeCounts> object if successful. + */ + public PagedList listPoolNodeCountsNext(final String nextPageLink) { + ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> response = listPoolNodeCountsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPoolNodeCountsNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @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> listPoolNodeCountsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listPoolNodeCountsNextSinglePageAsync(nextPageLink), + new Func1, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) { + return listPoolNodeCountsNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @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<PoolNodeCounts> object + */ + public Observable> listPoolNodeCountsNextAsync(final String nextPageLink) { + return listPoolNodeCountsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, AccountListPoolNodeCountsHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> response) { + return response.body(); + } + }); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @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<PoolNodeCounts> object + */ + public Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsNextWithServiceResponseAsync(final String nextPageLink) { + return listPoolNodeCountsNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, AccountListPoolNodeCountsHeaders>, Observable, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listPoolNodeCountsNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PoolNodeCounts> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listPoolNodeCountsNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> result = listPoolNodeCountsNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListPoolNodeCountsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolNodeCounts> object if successful. + */ + public PagedList listPoolNodeCountsNext(final String nextPageLink, final AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions) { + ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> response = listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListPoolNodeCountsNextOptions Additional parameters for the 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> listPoolNodeCountsNextAsync(final String nextPageLink, final AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions), + new Func1, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) { + return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions); + } + }, + serviceCallback); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListPoolNodeCountsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + public Observable> listPoolNodeCountsNextAsync(final String nextPageLink, final AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions) { + return listPoolNodeCountsNextWithServiceResponseAsync(nextPageLink, accountListPoolNodeCountsNextOptions) + .map(new Func1, AccountListPoolNodeCountsHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> response) { + return response.body(); + } + }); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param accountListPoolNodeCountsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolNodeCounts> object + */ + public Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsNextWithServiceResponseAsync(final String nextPageLink, final AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions) { + return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions) + .concatMap(new Func1, AccountListPoolNodeCountsHeaders>, Observable, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listPoolNodeCountsNextWithServiceResponseAsync(nextPageLink, accountListPoolNodeCountsNextOptions)); + } + }); + } + + /** + * Gets the number of nodes in each state, grouped by pool. + * + ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> * @param accountListPoolNodeCountsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PoolNodeCounts> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsNextSinglePageAsync(final String nextPageLink, final AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(accountListPoolNodeCountsNextOptions); + UUID clientRequestId = null; + if (accountListPoolNodeCountsNextOptions != null) { + clientRequestId = accountListPoolNodeCountsNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (accountListPoolNodeCountsNextOptions != null) { + returnClientRequestId = accountListPoolNodeCountsNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (accountListPoolNodeCountsNextOptions != null) { + ocpDate = accountListPoolNodeCountsNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listPoolNodeCountsNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, AccountListPoolNodeCountsHeaders>>>() { + @Override + public Observable, AccountListPoolNodeCountsHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> result = listPoolNodeCountsNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, AccountListPoolNodeCountsHeaders> listPoolNodeCountsNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, AccountListPoolNodeCountsHeaders.class); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ApplicationsImpl.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ApplicationsImpl.java new file mode 100644 index 000000000000..e3b4ddb83c74 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ApplicationsImpl.java @@ -0,0 +1,813 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.batch.protocol.Applications; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.batch.protocol.models.ApplicationGetHeaders; +import com.microsoft.azure.batch.protocol.models.ApplicationGetOptions; +import com.microsoft.azure.batch.protocol.models.ApplicationListHeaders; +import com.microsoft.azure.batch.protocol.models.ApplicationListNextOptions; +import com.microsoft.azure.batch.protocol.models.ApplicationListOptions; +import com.microsoft.azure.batch.protocol.models.ApplicationSummary; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.PageImpl; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.DateTimeRfc1123; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 ApplicationsImpl implements Applications { + /** The Retrofit service to perform REST calls. */ + private ApplicationsService service; + /** The service client containing this operation class. */ + private BatchServiceClientImpl client; + + /** + * Initializes an instance of ApplicationsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApplicationsImpl(Retrofit retrofit, BatchServiceClientImpl 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.batch.protocol.Applications list" }) + @GET("applications") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Applications get" }) + @GET("applications/{applicationId}") + Observable> get(@Path("applicationId") String applicationId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Applications listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ApplicationSummary> object if successful. + */ + public PagedList list() { + ServiceResponseWithHeaders, ApplicationListHeaders> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @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.fromHeaderPageResponse( + listSinglePageAsync(), + new Func1, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1, ApplicationListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, ApplicationListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + public Observable, ApplicationListHeaders>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1, ApplicationListHeaders>, Observable, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(ServiceResponseWithHeaders, ApplicationListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationSummary> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, ApplicationListHeaders>> listSinglePageAsync() { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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 ApplicationListOptions applicationListOptions = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, ApplicationListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, ApplicationListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ApplicationSummary> object if successful. + */ + public PagedList list(final ApplicationListOptions applicationListOptions) { + ServiceResponseWithHeaders, ApplicationListHeaders> response = listSinglePageAsync(applicationListOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + ApplicationListNextOptions applicationListNextOptions = null; + if (applicationListOptions != null) { + applicationListNextOptions = new ApplicationListNextOptions(); + applicationListNextOptions.withClientRequestId(applicationListOptions.clientRequestId()); + applicationListNextOptions.withReturnClientRequestId(applicationListOptions.returnClientRequestId()); + applicationListNextOptions.withOcpDate(applicationListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, applicationListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationListOptions Additional parameters for the operation + * @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 ApplicationListOptions applicationListOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(applicationListOptions), + new Func1, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(String nextPageLink) { + ApplicationListNextOptions applicationListNextOptions = null; + if (applicationListOptions != null) { + applicationListNextOptions = new ApplicationListNextOptions(); + applicationListNextOptions.withClientRequestId(applicationListOptions.clientRequestId()); + applicationListNextOptions.withReturnClientRequestId(applicationListOptions.returnClientRequestId()); + applicationListNextOptions.withOcpDate(applicationListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, applicationListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + public Observable> listAsync(final ApplicationListOptions applicationListOptions) { + return listWithServiceResponseAsync(applicationListOptions) + .map(new Func1, ApplicationListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, ApplicationListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + public Observable, ApplicationListHeaders>> listWithServiceResponseAsync(final ApplicationListOptions applicationListOptions) { + return listSinglePageAsync(applicationListOptions) + .concatMap(new Func1, ApplicationListHeaders>, Observable, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(ServiceResponseWithHeaders, ApplicationListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + ApplicationListNextOptions applicationListNextOptions = null; + if (applicationListOptions != null) { + applicationListNextOptions = new ApplicationListNextOptions(); + applicationListNextOptions.withClientRequestId(applicationListOptions.clientRequestId()); + applicationListNextOptions.withReturnClientRequestId(applicationListOptions.returnClientRequestId()); + applicationListNextOptions.withOcpDate(applicationListOptions.ocpDate()); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, applicationListNextOptions)); + } + }); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + ServiceResponseWithHeaders, ApplicationListHeaders> * @param applicationListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationSummary> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, ApplicationListHeaders>> listSinglePageAsync(final ApplicationListOptions applicationListOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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(applicationListOptions); + Integer maxResults = null; + if (applicationListOptions != null) { + maxResults = applicationListOptions.maxResults(); + } + Integer timeout = null; + if (applicationListOptions != null) { + timeout = applicationListOptions.timeout(); + } + UUID clientRequestId = null; + if (applicationListOptions != null) { + clientRequestId = applicationListOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (applicationListOptions != null) { + returnClientRequestId = applicationListOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (applicationListOptions != null) { + ocpDate = applicationListOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, ApplicationListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, ApplicationListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, ApplicationListHeaders> listDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ApplicationListHeaders.class); + } + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplicationSummary object if successful. + */ + public ApplicationSummary get(String applicationId) { + return getWithServiceResponseAsync(applicationId).toBlocking().single().body(); + } + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @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 applicationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(applicationId), serviceCallback); + } + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationSummary object + */ + public Observable getAsync(String applicationId) { + return getWithServiceResponseAsync(applicationId).map(new Func1, ApplicationSummary>() { + @Override + public ApplicationSummary call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationSummary object + */ + public Observable> getWithServiceResponseAsync(String applicationId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (applicationId == null) { + throw new IllegalArgumentException("Parameter applicationId 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 ApplicationGetOptions applicationGetOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.get(applicationId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @param applicationGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplicationSummary object if successful. + */ + public ApplicationSummary get(String applicationId, ApplicationGetOptions applicationGetOptions) { + return getWithServiceResponseAsync(applicationId, applicationGetOptions).toBlocking().single().body(); + } + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @param applicationGetOptions Additional parameters for the operation + * @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 applicationId, ApplicationGetOptions applicationGetOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(applicationId, applicationGetOptions), serviceCallback); + } + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @param applicationGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationSummary object + */ + public Observable getAsync(String applicationId, ApplicationGetOptions applicationGetOptions) { + return getWithServiceResponseAsync(applicationId, applicationGetOptions).map(new Func1, ApplicationSummary>() { + @Override + public ApplicationSummary call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified application. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param applicationId The ID of the application. + * @param applicationGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationSummary object + */ + public Observable> getWithServiceResponseAsync(String applicationId, ApplicationGetOptions applicationGetOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (applicationId == null) { + throw new IllegalArgumentException("Parameter applicationId 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(applicationGetOptions); + Integer timeout = null; + if (applicationGetOptions != null) { + timeout = applicationGetOptions.timeout(); + } + UUID clientRequestId = null; + if (applicationGetOptions != null) { + clientRequestId = applicationGetOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (applicationGetOptions != null) { + returnClientRequestId = applicationGetOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (applicationGetOptions != null) { + ocpDate = applicationGetOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.get(applicationId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ApplicationGetHeaders.class); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ApplicationSummary> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponseWithHeaders, ApplicationListHeaders> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @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.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @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<ApplicationSummary> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, ApplicationListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, ApplicationListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @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<ApplicationSummary> object + */ + public Observable, ApplicationListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, ApplicationListHeaders>, Observable, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(ServiceResponseWithHeaders, ApplicationListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationSummary> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, ApplicationListHeaders>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final ApplicationListNextOptions applicationListNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, ApplicationListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, ApplicationListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param applicationListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ApplicationSummary> object if successful. + */ + public PagedList listNext(final String nextPageLink, final ApplicationListNextOptions applicationListNextOptions) { + ServiceResponseWithHeaders, ApplicationListHeaders> response = listNextSinglePageAsync(nextPageLink, applicationListNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, applicationListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param applicationListNextOptions Additional parameters for the 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 ApplicationListNextOptions applicationListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink, applicationListNextOptions), + new Func1, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, applicationListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param applicationListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + public Observable> listNextAsync(final String nextPageLink, final ApplicationListNextOptions applicationListNextOptions) { + return listNextWithServiceResponseAsync(nextPageLink, applicationListNextOptions) + .map(new Func1, ApplicationListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, ApplicationListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param applicationListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationSummary> object + */ + public Observable, ApplicationListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final ApplicationListNextOptions applicationListNextOptions) { + return listNextSinglePageAsync(nextPageLink, applicationListNextOptions) + .concatMap(new Func1, ApplicationListHeaders>, Observable, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(ServiceResponseWithHeaders, ApplicationListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, applicationListNextOptions)); + } + }); + } + + /** + * Lists all of the applications available in the specified account. + * This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. + * + ServiceResponseWithHeaders, ApplicationListHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, ApplicationListHeaders> * @param applicationListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationSummary> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, ApplicationListHeaders>> listNextSinglePageAsync(final String nextPageLink, final ApplicationListNextOptions applicationListNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(applicationListNextOptions); + UUID clientRequestId = null; + if (applicationListNextOptions != null) { + clientRequestId = applicationListNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (applicationListNextOptions != null) { + returnClientRequestId = applicationListNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (applicationListNextOptions != null) { + ocpDate = applicationListNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, ApplicationListHeaders>>>() { + @Override + public Observable, ApplicationListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, ApplicationListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, ApplicationListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, ApplicationListHeaders> listNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ApplicationListHeaders.class); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/BatchServiceClientImpl.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/BatchServiceClientImpl.java new file mode 100644 index 000000000000..69be9e8420cc --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/BatchServiceClientImpl.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.batch.protocol.Accounts; +import com.microsoft.azure.batch.protocol.Applications; +import com.microsoft.azure.batch.protocol.BatchServiceClient; +import com.microsoft.azure.batch.protocol.Certificates; +import com.microsoft.azure.batch.protocol.ComputeNodes; +import com.microsoft.azure.batch.protocol.Files; +import com.microsoft.azure.batch.protocol.Jobs; +import com.microsoft.azure.batch.protocol.JobSchedules; +import com.microsoft.azure.batch.protocol.Pools; +import com.microsoft.azure.batch.protocol.Tasks; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the BatchServiceClientImpl class. + */ +public class BatchServiceClientImpl extends AzureServiceClient implements BatchServiceClient { + /** 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; + } + + /** Client API Version. */ + private String apiVersion; + + /** + * Gets Client API Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The base URL for all Azure Batch service requests. */ + private String batchUrl; + + /** + * Gets The base URL for all Azure Batch service requests. + * + * @return the batchUrl value. + */ + public String batchUrl() { + return this.batchUrl; + } + + /** + * Sets The base URL for all Azure Batch service requests. + * + * @param batchUrl the batchUrl value. + * @return the service client itself + */ + public BatchServiceClientImpl withBatchUrl(String batchUrl) { + this.batchUrl = batchUrl; + return this; + } + + /** 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 BatchServiceClientImpl 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 BatchServiceClientImpl 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 BatchServiceClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The Applications object to access its operations. + */ + private Applications applications; + + /** + * Gets the Applications object to access its operations. + * @return the Applications object. + */ + public Applications applications() { + return this.applications; + } + + /** + * The Pools object to access its operations. + */ + private Pools pools; + + /** + * Gets the Pools object to access its operations. + * @return the Pools object. + */ + public Pools pools() { + return this.pools; + } + + /** + * The Accounts object to access its operations. + */ + private Accounts accounts; + + /** + * Gets the Accounts object to access its operations. + * @return the Accounts object. + */ + public Accounts accounts() { + return this.accounts; + } + + /** + * The Jobs object to access its operations. + */ + private Jobs jobs; + + /** + * Gets the Jobs object to access its operations. + * @return the Jobs object. + */ + public Jobs jobs() { + return this.jobs; + } + + /** + * The Certificates object to access its operations. + */ + private Certificates certificates; + + /** + * Gets the Certificates object to access its operations. + * @return the Certificates object. + */ + public Certificates certificates() { + return this.certificates; + } + + /** + * The Files object to access its operations. + */ + private Files files; + + /** + * Gets the Files object to access its operations. + * @return the Files object. + */ + public Files files() { + return this.files; + } + + /** + * The JobSchedules object to access its operations. + */ + private JobSchedules jobSchedules; + + /** + * Gets the JobSchedules object to access its operations. + * @return the JobSchedules object. + */ + public JobSchedules jobSchedules() { + return this.jobSchedules; + } + + /** + * The Tasks object to access its operations. + */ + private Tasks tasks; + + /** + * Gets the Tasks object to access its operations. + * @return the Tasks object. + */ + public Tasks tasks() { + return this.tasks; + } + + /** + * The ComputeNodes object to access its operations. + */ + private ComputeNodes computeNodes; + + /** + * Gets the ComputeNodes object to access its operations. + * @return the ComputeNodes object. + */ + public ComputeNodes computeNodes() { + return this.computeNodes; + } + + /** + * Initializes an instance of BatchServiceClient client. + * + * @param credentials the management credentials for Azure + */ + public BatchServiceClientImpl(ServiceClientCredentials credentials) { + this("https://{batchUrl}", credentials); + } + + /** + * Initializes an instance of BatchServiceClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + private BatchServiceClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of BatchServiceClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public BatchServiceClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-12-01.8.0"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.applications = new ApplicationsImpl(restClient().retrofit(), this); + this.pools = new PoolsImpl(restClient().retrofit(), this); + this.accounts = new AccountsImpl(restClient().retrofit(), this); + this.jobs = new JobsImpl(restClient().retrofit(), this); + this.certificates = new CertificatesImpl(restClient().retrofit(), this); + this.files = new FilesImpl(restClient().retrofit(), this); + this.jobSchedules = new JobSchedulesImpl(restClient().retrofit(), this); + this.tasks = new TasksImpl(restClient().retrofit(), this); + this.computeNodes = new ComputeNodesImpl(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)", super.userAgent(), "BatchServiceClient", "2018-12-01.8.0"); + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java new file mode 100644 index 000000000000..897639cd8af7 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java @@ -0,0 +1,1437 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.batch.protocol.Certificates; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.Certificate; +import com.microsoft.azure.batch.protocol.models.CertificateAddHeaders; +import com.microsoft.azure.batch.protocol.models.CertificateAddOptions; +import com.microsoft.azure.batch.protocol.models.CertificateAddParameter; +import com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionHeaders; +import com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionOptions; +import com.microsoft.azure.batch.protocol.models.CertificateDeleteHeaders; +import com.microsoft.azure.batch.protocol.models.CertificateDeleteOptions; +import com.microsoft.azure.batch.protocol.models.CertificateGetHeaders; +import com.microsoft.azure.batch.protocol.models.CertificateGetOptions; +import com.microsoft.azure.batch.protocol.models.CertificateListHeaders; +import com.microsoft.azure.batch.protocol.models.CertificateListNextOptions; +import com.microsoft.azure.batch.protocol.models.CertificateListOptions; +import com.microsoft.azure.batch.protocol.models.PageImpl; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.DateTimeRfc1123; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +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.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 Certificates. + */ +public class CertificatesImpl implements Certificates { + /** The Retrofit service to perform REST calls. */ + private CertificatesService service; + /** The service client containing this operation class. */ + private BatchServiceClientImpl client; + + /** + * Initializes an instance of CertificatesImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CertificatesImpl(Retrofit retrofit, BatchServiceClientImpl client) { + this.service = retrofit.create(CertificatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Certificates to be + * used by Retrofit to perform actually REST calls. + */ + interface CertificatesService { + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Certificates add" }) + @POST("certificates") + Observable> add(@Body CertificateAddParameter certificate, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Certificates list" }) + @GET("certificates") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("$select") String select, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Certificates cancelDeletion" }) + @POST("certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})/canceldelete") + Observable> cancelDeletion(@Path("thumbprintAlgorithm") String thumbprintAlgorithm, @Path("thumbprint") String thumbprint, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Certificates delete" }) + @HTTP(path = "certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})", method = "DELETE", hasBody = true) + Observable> delete(@Path("thumbprintAlgorithm") String thumbprintAlgorithm, @Path("thumbprint") String thumbprint, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Certificates get" }) + @GET("certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})") + Observable> get(@Path("thumbprintAlgorithm") String thumbprintAlgorithm, @Path("thumbprint") String thumbprint, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$select") String select, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Certificates listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + } + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void add(CertificateAddParameter certificate) { + addWithServiceResponseAsync(certificate).toBlocking().single().body(); + } + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @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 addAsync(CertificateAddParameter certificate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(certificate), serviceCallback); + } + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addAsync(CertificateAddParameter certificate) { + return addWithServiceResponseAsync(certificate).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addWithServiceResponseAsync(CertificateAddParameter certificate) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (certificate == null) { + throw new IllegalArgumentException("Parameter certificate 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(certificate); + final CertificateAddOptions certificateAddOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.add(certificate, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @param certificateAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void add(CertificateAddParameter certificate, CertificateAddOptions certificateAddOptions) { + addWithServiceResponseAsync(certificate, certificateAddOptions).toBlocking().single().body(); + } + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @param certificateAddOptions Additional parameters for the operation + * @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 addAsync(CertificateAddParameter certificate, CertificateAddOptions certificateAddOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(certificate, certificateAddOptions), serviceCallback); + } + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @param certificateAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addAsync(CertificateAddParameter certificate, CertificateAddOptions certificateAddOptions) { + return addWithServiceResponseAsync(certificate, certificateAddOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a certificate to the specified account. + * + * @param certificate The certificate to be added. + * @param certificateAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addWithServiceResponseAsync(CertificateAddParameter certificate, CertificateAddOptions certificateAddOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (certificate == null) { + throw new IllegalArgumentException("Parameter certificate 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(certificate); + Validator.validate(certificateAddOptions); + Integer timeout = null; + if (certificateAddOptions != null) { + timeout = certificateAddOptions.timeout(); + } + UUID clientRequestId = null; + if (certificateAddOptions != null) { + clientRequestId = certificateAddOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (certificateAddOptions != null) { + returnClientRequestId = certificateAddOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (certificateAddOptions != null) { + ocpDate = certificateAddOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.add(certificate, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders addDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, CertificateAddHeaders.class); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<Certificate> object if successful. + */ + public PagedList list() { + ServiceResponseWithHeaders, CertificateListHeaders> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the certificates that have been added to the specified 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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(), + new Func1, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1, CertificateListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, CertificateListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + public Observable, CertificateListHeaders>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1, CertificateListHeaders>, Observable, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(ServiceResponseWithHeaders, CertificateListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<Certificate> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, CertificateListHeaders>> listSinglePageAsync() { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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 CertificateListOptions certificateListOptions = null; + String filter = null; + String select = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, CertificateListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, CertificateListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param certificateListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<Certificate> object if successful. + */ + public PagedList list(final CertificateListOptions certificateListOptions) { + ServiceResponseWithHeaders, CertificateListHeaders> response = listSinglePageAsync(certificateListOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + CertificateListNextOptions certificateListNextOptions = null; + if (certificateListOptions != null) { + certificateListNextOptions = new CertificateListNextOptions(); + certificateListNextOptions.withClientRequestId(certificateListOptions.clientRequestId()); + certificateListNextOptions.withReturnClientRequestId(certificateListOptions.returnClientRequestId()); + certificateListNextOptions.withOcpDate(certificateListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, certificateListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param certificateListOptions Additional parameters for the operation + * @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 CertificateListOptions certificateListOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(certificateListOptions), + new Func1, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(String nextPageLink) { + CertificateListNextOptions certificateListNextOptions = null; + if (certificateListOptions != null) { + certificateListNextOptions = new CertificateListNextOptions(); + certificateListNextOptions.withClientRequestId(certificateListOptions.clientRequestId()); + certificateListNextOptions.withReturnClientRequestId(certificateListOptions.returnClientRequestId()); + certificateListNextOptions.withOcpDate(certificateListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, certificateListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param certificateListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + public Observable> listAsync(final CertificateListOptions certificateListOptions) { + return listWithServiceResponseAsync(certificateListOptions) + .map(new Func1, CertificateListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, CertificateListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param certificateListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + public Observable, CertificateListHeaders>> listWithServiceResponseAsync(final CertificateListOptions certificateListOptions) { + return listSinglePageAsync(certificateListOptions) + .concatMap(new Func1, CertificateListHeaders>, Observable, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(ServiceResponseWithHeaders, CertificateListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + CertificateListNextOptions certificateListNextOptions = null; + if (certificateListOptions != null) { + certificateListNextOptions = new CertificateListNextOptions(); + certificateListNextOptions.withClientRequestId(certificateListOptions.clientRequestId()); + certificateListNextOptions.withReturnClientRequestId(certificateListOptions.returnClientRequestId()); + certificateListNextOptions.withOcpDate(certificateListOptions.ocpDate()); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, certificateListNextOptions)); + } + }); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + ServiceResponseWithHeaders, CertificateListHeaders> * @param certificateListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<Certificate> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, CertificateListHeaders>> listSinglePageAsync(final CertificateListOptions certificateListOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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(certificateListOptions); + String filter = null; + if (certificateListOptions != null) { + filter = certificateListOptions.filter(); + } + String select = null; + if (certificateListOptions != null) { + select = certificateListOptions.select(); + } + Integer maxResults = null; + if (certificateListOptions != null) { + maxResults = certificateListOptions.maxResults(); + } + Integer timeout = null; + if (certificateListOptions != null) { + timeout = certificateListOptions.timeout(); + } + UUID clientRequestId = null; + if (certificateListOptions != null) { + clientRequestId = certificateListOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (certificateListOptions != null) { + returnClientRequestId = certificateListOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (certificateListOptions != null) { + ocpDate = certificateListOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, CertificateListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, CertificateListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, CertificateListHeaders> listDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, CertificateListHeaders.class); + } + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void cancelDeletion(String thumbprintAlgorithm, String thumbprint) { + cancelDeletionWithServiceResponseAsync(thumbprintAlgorithm, thumbprint).toBlocking().single().body(); + } + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being 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 cancelDeletionAsync(String thumbprintAlgorithm, String thumbprint, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(cancelDeletionWithServiceResponseAsync(thumbprintAlgorithm, thumbprint), serviceCallback); + } + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable cancelDeletionAsync(String thumbprintAlgorithm, String thumbprint) { + return cancelDeletionWithServiceResponseAsync(thumbprintAlgorithm, thumbprint).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> cancelDeletionWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (thumbprintAlgorithm == null) { + throw new IllegalArgumentException("Parameter thumbprintAlgorithm is required and cannot be null."); + } + if (thumbprint == null) { + throw new IllegalArgumentException("Parameter thumbprint 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 CertificateCancelDeletionOptions certificateCancelDeletionOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.cancelDeletion(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = cancelDeletionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @param certificateCancelDeletionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void cancelDeletion(String thumbprintAlgorithm, String thumbprint, CertificateCancelDeletionOptions certificateCancelDeletionOptions) { + cancelDeletionWithServiceResponseAsync(thumbprintAlgorithm, thumbprint, certificateCancelDeletionOptions).toBlocking().single().body(); + } + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @param certificateCancelDeletionOptions Additional parameters for the operation + * @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 cancelDeletionAsync(String thumbprintAlgorithm, String thumbprint, CertificateCancelDeletionOptions certificateCancelDeletionOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(cancelDeletionWithServiceResponseAsync(thumbprintAlgorithm, thumbprint, certificateCancelDeletionOptions), serviceCallback); + } + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @param certificateCancelDeletionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable cancelDeletionAsync(String thumbprintAlgorithm, String thumbprint, CertificateCancelDeletionOptions certificateCancelDeletionOptions) { + return cancelDeletionWithServiceResponseAsync(thumbprintAlgorithm, thumbprint, certificateCancelDeletionOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Cancels a failed deletion of a certificate from the specified account. + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate being deleted. + * @param certificateCancelDeletionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> cancelDeletionWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint, CertificateCancelDeletionOptions certificateCancelDeletionOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (thumbprintAlgorithm == null) { + throw new IllegalArgumentException("Parameter thumbprintAlgorithm is required and cannot be null."); + } + if (thumbprint == null) { + throw new IllegalArgumentException("Parameter thumbprint 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(certificateCancelDeletionOptions); + Integer timeout = null; + if (certificateCancelDeletionOptions != null) { + timeout = certificateCancelDeletionOptions.timeout(); + } + UUID clientRequestId = null; + if (certificateCancelDeletionOptions != null) { + clientRequestId = certificateCancelDeletionOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (certificateCancelDeletionOptions != null) { + returnClientRequestId = certificateCancelDeletionOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (certificateCancelDeletionOptions != null) { + ocpDate = certificateCancelDeletionOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.cancelDeletion(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = cancelDeletionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders cancelDeletionDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, CertificateCancelDeletionHeaders.class); + } + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 thumbprintAlgorithm, String thumbprint) { + deleteWithServiceResponseAsync(thumbprintAlgorithm, thumbprint).toBlocking().single().body(); + } + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate 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 thumbprintAlgorithm, String thumbprint, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(thumbprintAlgorithm, thumbprint), serviceCallback); + } + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteAsync(String thumbprintAlgorithm, String thumbprint) { + return deleteWithServiceResponseAsync(thumbprintAlgorithm, thumbprint).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (thumbprintAlgorithm == null) { + throw new IllegalArgumentException("Parameter thumbprintAlgorithm is required and cannot be null."); + } + if (thumbprint == null) { + throw new IllegalArgumentException("Parameter thumbprint 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 CertificateDeleteOptions certificateDeleteOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.delete(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @param certificateDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 thumbprintAlgorithm, String thumbprint, CertificateDeleteOptions certificateDeleteOptions) { + deleteWithServiceResponseAsync(thumbprintAlgorithm, thumbprint, certificateDeleteOptions).toBlocking().single().body(); + } + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @param certificateDeleteOptions Additional parameters for the operation + * @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 thumbprintAlgorithm, String thumbprint, CertificateDeleteOptions certificateDeleteOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(thumbprintAlgorithm, thumbprint, certificateDeleteOptions), serviceCallback); + } + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @param certificateDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteAsync(String thumbprintAlgorithm, String thumbprint, CertificateDeleteOptions certificateDeleteOptions) { + return deleteWithServiceResponseAsync(thumbprintAlgorithm, thumbprint, certificateDeleteOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a certificate from the specified account. + * You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to be deleted. + * @param certificateDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint, CertificateDeleteOptions certificateDeleteOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (thumbprintAlgorithm == null) { + throw new IllegalArgumentException("Parameter thumbprintAlgorithm is required and cannot be null."); + } + if (thumbprint == null) { + throw new IllegalArgumentException("Parameter thumbprint 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(certificateDeleteOptions); + Integer timeout = null; + if (certificateDeleteOptions != null) { + timeout = certificateDeleteOptions.timeout(); + } + UUID clientRequestId = null; + if (certificateDeleteOptions != null) { + clientRequestId = certificateDeleteOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (certificateDeleteOptions != null) { + returnClientRequestId = certificateDeleteOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (certificateDeleteOptions != null) { + ocpDate = certificateDeleteOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.delete(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders deleteDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, CertificateDeleteHeaders.class); + } + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Certificate object if successful. + */ + public Certificate get(String thumbprintAlgorithm, String thumbprint) { + return getWithServiceResponseAsync(thumbprintAlgorithm, thumbprint).toBlocking().single().body(); + } + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @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 thumbprintAlgorithm, String thumbprint, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(thumbprintAlgorithm, thumbprint), serviceCallback); + } + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Certificate object + */ + public Observable getAsync(String thumbprintAlgorithm, String thumbprint) { + return getWithServiceResponseAsync(thumbprintAlgorithm, thumbprint).map(new Func1, Certificate>() { + @Override + public Certificate call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Certificate object + */ + public Observable> getWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (thumbprintAlgorithm == null) { + throw new IllegalArgumentException("Parameter thumbprintAlgorithm is required and cannot be null."); + } + if (thumbprint == null) { + throw new IllegalArgumentException("Parameter thumbprint 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 CertificateGetOptions certificateGetOptions = null; + String select = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.get(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), select, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @param certificateGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Certificate object if successful. + */ + public Certificate get(String thumbprintAlgorithm, String thumbprint, CertificateGetOptions certificateGetOptions) { + return getWithServiceResponseAsync(thumbprintAlgorithm, thumbprint, certificateGetOptions).toBlocking().single().body(); + } + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @param certificateGetOptions Additional parameters for the operation + * @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 thumbprintAlgorithm, String thumbprint, CertificateGetOptions certificateGetOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(thumbprintAlgorithm, thumbprint, certificateGetOptions), serviceCallback); + } + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @param certificateGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Certificate object + */ + public Observable getAsync(String thumbprintAlgorithm, String thumbprint, CertificateGetOptions certificateGetOptions) { + return getWithServiceResponseAsync(thumbprintAlgorithm, thumbprint, certificateGetOptions).map(new Func1, Certificate>() { + @Override + public Certificate call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified certificate. + * + * @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. + * @param thumbprint The thumbprint of the certificate to get. + * @param certificateGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Certificate object + */ + public Observable> getWithServiceResponseAsync(String thumbprintAlgorithm, String thumbprint, CertificateGetOptions certificateGetOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (thumbprintAlgorithm == null) { + throw new IllegalArgumentException("Parameter thumbprintAlgorithm is required and cannot be null."); + } + if (thumbprint == null) { + throw new IllegalArgumentException("Parameter thumbprint 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(certificateGetOptions); + String select = null; + if (certificateGetOptions != null) { + select = certificateGetOptions.select(); + } + Integer timeout = null; + if (certificateGetOptions != null) { + timeout = certificateGetOptions.timeout(); + } + UUID clientRequestId = null; + if (certificateGetOptions != null) { + clientRequestId = certificateGetOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (certificateGetOptions != null) { + returnClientRequestId = certificateGetOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (certificateGetOptions != null) { + ocpDate = certificateGetOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.get(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), select, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, CertificateGetHeaders.class); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<Certificate> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponseWithHeaders, CertificateListHeaders> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the certificates that have been added to 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.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the certificates that have been added to 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<Certificate> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, CertificateListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, CertificateListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the certificates that have been added to 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<Certificate> object + */ + public Observable, CertificateListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, CertificateListHeaders>, Observable, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(ServiceResponseWithHeaders, CertificateListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the certificates that have been added to 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 PagedList<Certificate> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, CertificateListHeaders>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final CertificateListNextOptions certificateListNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, CertificateListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, CertificateListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param certificateListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<Certificate> object if successful. + */ + public PagedList listNext(final String nextPageLink, final CertificateListNextOptions certificateListNextOptions) { + ServiceResponseWithHeaders, CertificateListHeaders> response = listNextSinglePageAsync(nextPageLink, certificateListNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, certificateListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param certificateListNextOptions Additional parameters for the 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 CertificateListNextOptions certificateListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink, certificateListNextOptions), + new Func1, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, certificateListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param certificateListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + public Observable> listNextAsync(final String nextPageLink, final CertificateListNextOptions certificateListNextOptions) { + return listNextWithServiceResponseAsync(nextPageLink, certificateListNextOptions) + .map(new Func1, CertificateListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, CertificateListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param certificateListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Certificate> object + */ + public Observable, CertificateListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final CertificateListNextOptions certificateListNextOptions) { + return listNextSinglePageAsync(nextPageLink, certificateListNextOptions) + .concatMap(new Func1, CertificateListHeaders>, Observable, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(ServiceResponseWithHeaders, CertificateListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, certificateListNextOptions)); + } + }); + } + + /** + * Lists all of the certificates that have been added to the specified account. + * + ServiceResponseWithHeaders, CertificateListHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, CertificateListHeaders> * @param certificateListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<Certificate> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, CertificateListHeaders>> listNextSinglePageAsync(final String nextPageLink, final CertificateListNextOptions certificateListNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(certificateListNextOptions); + UUID clientRequestId = null; + if (certificateListNextOptions != null) { + clientRequestId = certificateListNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (certificateListNextOptions != null) { + returnClientRequestId = certificateListNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (certificateListNextOptions != null) { + ocpDate = certificateListNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, CertificateListHeaders>>>() { + @Override + public Observable, CertificateListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, CertificateListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, CertificateListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, CertificateListHeaders> listNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, CertificateListHeaders.class); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java new file mode 100644 index 000000000000..30bdb724e003 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java @@ -0,0 +1,3136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.batch.protocol.ComputeNodes; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.ComputeNode; +import com.microsoft.azure.batch.protocol.models.ComputeNodeAddUserHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeAddUserOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeDeleteUserHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeDeleteUserOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeDisableSchedulingHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeDisableSchedulingOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeEnableSchedulingHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeEnableSchedulingOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteDesktopHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteDesktopOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteLoginSettingsHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteLoginSettingsOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteLoginSettingsResult; +import com.microsoft.azure.batch.protocol.models.ComputeNodeListHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeListNextOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeListOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeRebootHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeRebootOption; +import com.microsoft.azure.batch.protocol.models.ComputeNodeRebootOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeReimageHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeReimageOption; +import com.microsoft.azure.batch.protocol.models.ComputeNodeReimageOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeUpdateUserHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeUpdateUserOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeUploadBatchServiceLogsHeaders; +import com.microsoft.azure.batch.protocol.models.ComputeNodeUploadBatchServiceLogsOptions; +import com.microsoft.azure.batch.protocol.models.ComputeNodeUser; +import com.microsoft.azure.batch.protocol.models.DisableComputeNodeSchedulingOption; +import com.microsoft.azure.batch.protocol.models.NodeDisableSchedulingParameter; +import com.microsoft.azure.batch.protocol.models.NodeRebootParameter; +import com.microsoft.azure.batch.protocol.models.NodeReimageParameter; +import com.microsoft.azure.batch.protocol.models.NodeUpdateUserParameter; +import com.microsoft.azure.batch.protocol.models.PageImpl; +import com.microsoft.azure.batch.protocol.models.UploadBatchServiceLogsConfiguration; +import com.microsoft.azure.batch.protocol.models.UploadBatchServiceLogsResult; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.DateTimeRfc1123; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.InputStream; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +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.http.Streaming; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +// Custom Imports +import java.io.OutputStream; +import rx.exceptions.Exceptions; +import rx.functions.Action1; + + +/** + * An instance of this class provides access to all the operations defined + * in ComputeNodes. + */ +public class ComputeNodesImpl implements ComputeNodes { + /** The Retrofit service to perform REST calls. */ + private ComputeNodesService service; + /** The service client containing this operation class. */ + private BatchServiceClientImpl client; + + /** + * Initializes an instance of ComputeNodesImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ComputeNodesImpl(Retrofit retrofit, BatchServiceClientImpl client) { + this.service = retrofit.create(ComputeNodesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ComputeNodes to be + * used by Retrofit to perform actually REST calls. + */ + interface ComputeNodesService { + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes addUser" }) + @POST("pools/{poolId}/nodes/{nodeId}/users") + Observable> addUser(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Body ComputeNodeUser user, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes deleteUser" }) + @HTTP(path = "pools/{poolId}/nodes/{nodeId}/users/{userName}", method = "DELETE", hasBody = true) + Observable> deleteUser(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Path("userName") String userName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes updateUser" }) + @PUT("pools/{poolId}/nodes/{nodeId}/users/{userName}") + Observable> updateUser(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Path("userName") String userName, @Body NodeUpdateUserParameter nodeUpdateUserParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes get" }) + @GET("pools/{poolId}/nodes/{nodeId}") + Observable> get(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$select") String select, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes reboot" }) + @POST("pools/{poolId}/nodes/{nodeId}/reboot") + Observable> reboot(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Body NodeRebootParameter nodeRebootParameter, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes reimage" }) + @POST("pools/{poolId}/nodes/{nodeId}/reimage") + Observable> reimage(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Body NodeReimageParameter nodeReimageParameter, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes disableScheduling" }) + @POST("pools/{poolId}/nodes/{nodeId}/disablescheduling") + Observable> disableScheduling(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Body NodeDisableSchedulingParameter nodeDisableSchedulingParameter, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes enableScheduling" }) + @POST("pools/{poolId}/nodes/{nodeId}/enablescheduling") + Observable> enableScheduling(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes getRemoteLoginSettings" }) + @GET("pools/{poolId}/nodes/{nodeId}/remoteloginsettings") + Observable> getRemoteLoginSettings(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes getRemoteDesktop" }) + @GET("pools/{poolId}/nodes/{nodeId}/rdp") + @Streaming + Observable> getRemoteDesktop(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes uploadBatchServiceLogs" }) + @POST("pools/{poolId}/nodes/{nodeId}/uploadbatchservicelogs") + Observable> uploadBatchServiceLogs(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Body UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes list" }) + @GET("pools/{poolId}/nodes") + Observable> list(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("$select") String select, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.ComputeNodes listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + } + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void addUser(String poolId, String nodeId, ComputeNodeUser user) { + addUserWithServiceResponseAsync(poolId, nodeId, user).toBlocking().single().body(); + } + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @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 addUserAsync(String poolId, String nodeId, ComputeNodeUser user, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addUserWithServiceResponseAsync(poolId, nodeId, user), serviceCallback); + } + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addUserAsync(String poolId, String nodeId, ComputeNodeUser user) { + return addUserWithServiceResponseAsync(poolId, nodeId, user).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addUserWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeUser user) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (user == null) { + throw new IllegalArgumentException("Parameter user 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(user); + final ComputeNodeAddUserOptions computeNodeAddUserOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.addUser(poolId, nodeId, user, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addUserDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @param computeNodeAddUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void addUser(String poolId, String nodeId, ComputeNodeUser user, ComputeNodeAddUserOptions computeNodeAddUserOptions) { + addUserWithServiceResponseAsync(poolId, nodeId, user, computeNodeAddUserOptions).toBlocking().single().body(); + } + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @param computeNodeAddUserOptions Additional parameters for the operation + * @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 addUserAsync(String poolId, String nodeId, ComputeNodeUser user, ComputeNodeAddUserOptions computeNodeAddUserOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addUserWithServiceResponseAsync(poolId, nodeId, user, computeNodeAddUserOptions), serviceCallback); + } + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @param computeNodeAddUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addUserAsync(String poolId, String nodeId, ComputeNodeUser user, ComputeNodeAddUserOptions computeNodeAddUserOptions) { + return addUserWithServiceResponseAsync(poolId, nodeId, user, computeNodeAddUserOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a user account to the specified compute node. + * You can add a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to create a user account. + * @param user The user account to be created. + * @param computeNodeAddUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addUserWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeUser user, ComputeNodeAddUserOptions computeNodeAddUserOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (user == null) { + throw new IllegalArgumentException("Parameter user 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(user); + Validator.validate(computeNodeAddUserOptions); + Integer timeout = null; + if (computeNodeAddUserOptions != null) { + timeout = computeNodeAddUserOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeAddUserOptions != null) { + clientRequestId = computeNodeAddUserOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeAddUserOptions != null) { + returnClientRequestId = computeNodeAddUserOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeAddUserOptions != null) { + ocpDate = computeNodeAddUserOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.addUser(poolId, nodeId, user, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addUserDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders addUserDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeAddUserHeaders.class); + } + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteUser(String poolId, String nodeId, String userName) { + deleteUserWithServiceResponseAsync(poolId, nodeId, userName).toBlocking().single().body(); + } + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account 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 deleteUserAsync(String poolId, String nodeId, String userName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteUserWithServiceResponseAsync(poolId, nodeId, userName), serviceCallback); + } + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteUserAsync(String poolId, String nodeId, String userName) { + return deleteUserWithServiceResponseAsync(poolId, nodeId, userName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteUserWithServiceResponseAsync(String poolId, String nodeId, String userName) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (userName == null) { + throw new IllegalArgumentException("Parameter userName 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 ComputeNodeDeleteUserOptions computeNodeDeleteUserOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.deleteUser(poolId, nodeId, userName, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteUserDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @param computeNodeDeleteUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteUser(String poolId, String nodeId, String userName, ComputeNodeDeleteUserOptions computeNodeDeleteUserOptions) { + deleteUserWithServiceResponseAsync(poolId, nodeId, userName, computeNodeDeleteUserOptions).toBlocking().single().body(); + } + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @param computeNodeDeleteUserOptions Additional parameters for the operation + * @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 deleteUserAsync(String poolId, String nodeId, String userName, ComputeNodeDeleteUserOptions computeNodeDeleteUserOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteUserWithServiceResponseAsync(poolId, nodeId, userName, computeNodeDeleteUserOptions), serviceCallback); + } + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @param computeNodeDeleteUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteUserAsync(String poolId, String nodeId, String userName, ComputeNodeDeleteUserOptions computeNodeDeleteUserOptions) { + return deleteUserWithServiceResponseAsync(poolId, nodeId, userName, computeNodeDeleteUserOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a user account from the specified compute node. + * You can delete a user account to a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to delete a user account. + * @param userName The name of the user account to delete. + * @param computeNodeDeleteUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteUserWithServiceResponseAsync(String poolId, String nodeId, String userName, ComputeNodeDeleteUserOptions computeNodeDeleteUserOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (userName == null) { + throw new IllegalArgumentException("Parameter userName 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(computeNodeDeleteUserOptions); + Integer timeout = null; + if (computeNodeDeleteUserOptions != null) { + timeout = computeNodeDeleteUserOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeDeleteUserOptions != null) { + clientRequestId = computeNodeDeleteUserOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeDeleteUserOptions != null) { + returnClientRequestId = computeNodeDeleteUserOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeDeleteUserOptions != null) { + ocpDate = computeNodeDeleteUserOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.deleteUser(poolId, nodeId, userName, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteUserDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders deleteUserDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeDeleteUserHeaders.class); + } + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void updateUser(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter) { + updateUserWithServiceResponseAsync(poolId, nodeId, userName, nodeUpdateUserParameter).toBlocking().single().body(); + } + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter 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 updateUserAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateUserWithServiceResponseAsync(poolId, nodeId, userName, nodeUpdateUserParameter), serviceCallback); + } + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable updateUserAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter) { + return updateUserWithServiceResponseAsync(poolId, nodeId, userName, nodeUpdateUserParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> updateUserWithServiceResponseAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (userName == null) { + throw new IllegalArgumentException("Parameter userName is required and cannot be null."); + } + if (nodeUpdateUserParameter == null) { + throw new IllegalArgumentException("Parameter nodeUpdateUserParameter 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(nodeUpdateUserParameter); + final ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.updateUser(poolId, nodeId, userName, nodeUpdateUserParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updateUserDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @param computeNodeUpdateUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void updateUser(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions) { + updateUserWithServiceResponseAsync(poolId, nodeId, userName, nodeUpdateUserParameter, computeNodeUpdateUserOptions).toBlocking().single().body(); + } + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @param computeNodeUpdateUserOptions Additional parameters for the operation + * @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 updateUserAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateUserWithServiceResponseAsync(poolId, nodeId, userName, nodeUpdateUserParameter, computeNodeUpdateUserOptions), serviceCallback); + } + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @param computeNodeUpdateUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable updateUserAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions) { + return updateUserWithServiceResponseAsync(poolId, nodeId, userName, nodeUpdateUserParameter, computeNodeUpdateUserOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the password and expiration time of a user account on the specified compute node. + * This operation replaces of all the updatable properties of the account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user account on a node only when it is in the idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the machine on which you want to update a user account. + * @param userName The name of the user account to update. + * @param nodeUpdateUserParameter The parameters for the request. + * @param computeNodeUpdateUserOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> updateUserWithServiceResponseAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (userName == null) { + throw new IllegalArgumentException("Parameter userName is required and cannot be null."); + } + if (nodeUpdateUserParameter == null) { + throw new IllegalArgumentException("Parameter nodeUpdateUserParameter 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(nodeUpdateUserParameter); + Validator.validate(computeNodeUpdateUserOptions); + Integer timeout = null; + if (computeNodeUpdateUserOptions != null) { + timeout = computeNodeUpdateUserOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeUpdateUserOptions != null) { + clientRequestId = computeNodeUpdateUserOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeUpdateUserOptions != null) { + returnClientRequestId = computeNodeUpdateUserOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeUpdateUserOptions != null) { + ocpDate = computeNodeUpdateUserOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.updateUser(poolId, nodeId, userName, nodeUpdateUserParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updateUserDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders updateUserDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeUpdateUserHeaders.class); + } + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ComputeNode object if successful. + */ + public ComputeNode get(String poolId, String nodeId) { + return getWithServiceResponseAsync(poolId, nodeId).toBlocking().single().body(); + } + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @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 poolId, String nodeId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(poolId, nodeId), serviceCallback); + } + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNode object + */ + public Observable getAsync(String poolId, String nodeId) { + return getWithServiceResponseAsync(poolId, nodeId).map(new Func1, ComputeNode>() { + @Override + public ComputeNode call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNode object + */ + public Observable> getWithServiceResponseAsync(String poolId, String nodeId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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 ComputeNodeGetOptions computeNodeGetOptions = null; + String select = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.get(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), select, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @param computeNodeGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ComputeNode object if successful. + */ + public ComputeNode get(String poolId, String nodeId, ComputeNodeGetOptions computeNodeGetOptions) { + return getWithServiceResponseAsync(poolId, nodeId, computeNodeGetOptions).toBlocking().single().body(); + } + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @param computeNodeGetOptions Additional parameters for the operation + * @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 poolId, String nodeId, ComputeNodeGetOptions computeNodeGetOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(poolId, nodeId, computeNodeGetOptions), serviceCallback); + } + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @param computeNodeGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNode object + */ + public Observable getAsync(String poolId, String nodeId, ComputeNodeGetOptions computeNodeGetOptions) { + return getWithServiceResponseAsync(poolId, nodeId, computeNodeGetOptions).map(new Func1, ComputeNode>() { + @Override + public ComputeNode call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to get information about. + * @param computeNodeGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNode object + */ + public Observable> getWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeGetOptions computeNodeGetOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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(computeNodeGetOptions); + String select = null; + if (computeNodeGetOptions != null) { + select = computeNodeGetOptions.select(); + } + Integer timeout = null; + if (computeNodeGetOptions != null) { + timeout = computeNodeGetOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeGetOptions != null) { + clientRequestId = computeNodeGetOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeGetOptions != null) { + returnClientRequestId = computeNodeGetOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeGetOptions != null) { + ocpDate = computeNodeGetOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.get(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), select, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeGetHeaders.class); + } + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void reboot(String poolId, String nodeId) { + rebootWithServiceResponseAsync(poolId, nodeId).toBlocking().single().body(); + } + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @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 rebootAsync(String poolId, String nodeId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(rebootWithServiceResponseAsync(poolId, nodeId), serviceCallback); + } + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable rebootAsync(String poolId, String nodeId) { + return rebootWithServiceResponseAsync(poolId, nodeId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> rebootWithServiceResponseAsync(String poolId, String nodeId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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 ComputeNodeRebootOption nodeRebootOption = null; + final ComputeNodeRebootOptions computeNodeRebootOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + NodeRebootParameter nodeRebootParameter = new NodeRebootParameter(); + nodeRebootParameter.withNodeRebootOption(null); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.reboot(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, nodeRebootParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = rebootDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeRebootOption When to reboot the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeRebootOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void reboot(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions) { + rebootWithServiceResponseAsync(poolId, nodeId, nodeRebootOption, computeNodeRebootOptions).toBlocking().single().body(); + } + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeRebootOption When to reboot the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeRebootOptions Additional parameters for the operation + * @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 rebootAsync(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(rebootWithServiceResponseAsync(poolId, nodeId, nodeRebootOption, computeNodeRebootOptions), serviceCallback); + } + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeRebootOption When to reboot the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeRebootOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable rebootAsync(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions) { + return rebootWithServiceResponseAsync(poolId, nodeId, nodeRebootOption, computeNodeRebootOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Restarts the specified compute node. + * You can restart a node only if it is in an idle or running state. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeRebootOption When to reboot the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeRebootOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> rebootWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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(computeNodeRebootOptions); + Integer timeout = null; + if (computeNodeRebootOptions != null) { + timeout = computeNodeRebootOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeRebootOptions != null) { + clientRequestId = computeNodeRebootOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeRebootOptions != null) { + returnClientRequestId = computeNodeRebootOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeRebootOptions != null) { + ocpDate = computeNodeRebootOptions.ocpDate(); + } + NodeRebootParameter nodeRebootParameter = null; + if (nodeRebootOption != null) { + nodeRebootParameter = new NodeRebootParameter(); + nodeRebootParameter.withNodeRebootOption(nodeRebootOption); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.reboot(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, nodeRebootParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = rebootDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders rebootDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeRebootHeaders.class); + } + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void reimage(String poolId, String nodeId) { + reimageWithServiceResponseAsync(poolId, nodeId).toBlocking().single().body(); + } + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @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 reimageAsync(String poolId, String nodeId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(reimageWithServiceResponseAsync(poolId, nodeId), serviceCallback); + } + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable reimageAsync(String poolId, String nodeId) { + return reimageWithServiceResponseAsync(poolId, nodeId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> reimageWithServiceResponseAsync(String poolId, String nodeId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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 ComputeNodeReimageOption nodeReimageOption = null; + final ComputeNodeReimageOptions computeNodeReimageOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + NodeReimageParameter nodeReimageParameter = new NodeReimageParameter(); + nodeReimageParameter.withNodeReimageOption(null); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.reimage(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, nodeReimageParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = reimageDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeReimageOption When to reimage the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeReimageOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void reimage(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, ComputeNodeReimageOptions computeNodeReimageOptions) { + reimageWithServiceResponseAsync(poolId, nodeId, nodeReimageOption, computeNodeReimageOptions).toBlocking().single().body(); + } + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeReimageOption When to reimage the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeReimageOptions Additional parameters for the operation + * @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 reimageAsync(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, ComputeNodeReimageOptions computeNodeReimageOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(reimageWithServiceResponseAsync(poolId, nodeId, nodeReimageOption, computeNodeReimageOptions), serviceCallback); + } + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeReimageOption When to reimage the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeReimageOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable reimageAsync(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, ComputeNodeReimageOptions computeNodeReimageOptions) { + return reimageWithServiceResponseAsync(poolId, nodeId, nodeReimageOption, computeNodeReimageOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Reinstalls the operating system on the specified compute node. + * You can reinstall the operating system on a node only if it is in an idle or running state. This API can be invoked only on pools created with the cloud service configuration property. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that you want to restart. + * @param nodeReimageOption When to reimage the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData' + * @param computeNodeReimageOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> reimageWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, ComputeNodeReimageOptions computeNodeReimageOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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(computeNodeReimageOptions); + Integer timeout = null; + if (computeNodeReimageOptions != null) { + timeout = computeNodeReimageOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeReimageOptions != null) { + clientRequestId = computeNodeReimageOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeReimageOptions != null) { + returnClientRequestId = computeNodeReimageOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeReimageOptions != null) { + ocpDate = computeNodeReimageOptions.ocpDate(); + } + NodeReimageParameter nodeReimageParameter = null; + if (nodeReimageOption != null) { + nodeReimageParameter = new NodeReimageParameter(); + nodeReimageParameter.withNodeReimageOption(nodeReimageOption); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.reimage(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, nodeReimageParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = reimageDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders reimageDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeReimageHeaders.class); + } + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void disableScheduling(String poolId, String nodeId) { + disableSchedulingWithServiceResponseAsync(poolId, nodeId).toBlocking().single().body(); + } + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @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 disableSchedulingAsync(String poolId, String nodeId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(disableSchedulingWithServiceResponseAsync(poolId, nodeId), serviceCallback); + } + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable disableSchedulingAsync(String poolId, String nodeId) { + return disableSchedulingWithServiceResponseAsync(poolId, nodeId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> disableSchedulingWithServiceResponseAsync(String poolId, String nodeId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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 DisableComputeNodeSchedulingOption nodeDisableSchedulingOption = null; + final ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + NodeDisableSchedulingParameter nodeDisableSchedulingParameter = new NodeDisableSchedulingParameter(); + nodeDisableSchedulingParameter.withNodeDisableSchedulingOption(null); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.disableScheduling(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, nodeDisableSchedulingParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = disableSchedulingDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @param nodeDisableSchedulingOption What to do with currently running tasks when disabling task scheduling on the compute node. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion' + * @param computeNodeDisableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void disableScheduling(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions) { + disableSchedulingWithServiceResponseAsync(poolId, nodeId, nodeDisableSchedulingOption, computeNodeDisableSchedulingOptions).toBlocking().single().body(); + } + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @param nodeDisableSchedulingOption What to do with currently running tasks when disabling task scheduling on the compute node. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion' + * @param computeNodeDisableSchedulingOptions Additional parameters for the operation + * @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 disableSchedulingAsync(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(disableSchedulingWithServiceResponseAsync(poolId, nodeId, nodeDisableSchedulingOption, computeNodeDisableSchedulingOptions), serviceCallback); + } + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @param nodeDisableSchedulingOption What to do with currently running tasks when disabling task scheduling on the compute node. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion' + * @param computeNodeDisableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable disableSchedulingAsync(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions) { + return disableSchedulingWithServiceResponseAsync(poolId, nodeId, nodeDisableSchedulingOption, computeNodeDisableSchedulingOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Disables task scheduling on the specified compute node. + * You can disable task scheduling on a node only if its current scheduling state is enabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to disable task scheduling. + * @param nodeDisableSchedulingOption What to do with currently running tasks when disabling task scheduling on the compute node. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion' + * @param computeNodeDisableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> disableSchedulingWithServiceResponseAsync(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption, ComputeNodeDisableSchedulingOptions computeNodeDisableSchedulingOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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(computeNodeDisableSchedulingOptions); + Integer timeout = null; + if (computeNodeDisableSchedulingOptions != null) { + timeout = computeNodeDisableSchedulingOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeDisableSchedulingOptions != null) { + clientRequestId = computeNodeDisableSchedulingOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeDisableSchedulingOptions != null) { + returnClientRequestId = computeNodeDisableSchedulingOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeDisableSchedulingOptions != null) { + ocpDate = computeNodeDisableSchedulingOptions.ocpDate(); + } + NodeDisableSchedulingParameter nodeDisableSchedulingParameter = null; + if (nodeDisableSchedulingOption != null) { + nodeDisableSchedulingParameter = new NodeDisableSchedulingParameter(); + nodeDisableSchedulingParameter.withNodeDisableSchedulingOption(nodeDisableSchedulingOption); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.disableScheduling(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, nodeDisableSchedulingParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = disableSchedulingDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders disableSchedulingDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeDisableSchedulingHeaders.class); + } + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enableScheduling(String poolId, String nodeId) { + enableSchedulingWithServiceResponseAsync(poolId, nodeId).toBlocking().single().body(); + } + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @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 enableSchedulingAsync(String poolId, String nodeId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(enableSchedulingWithServiceResponseAsync(poolId, nodeId), serviceCallback); + } + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable enableSchedulingAsync(String poolId, String nodeId) { + return enableSchedulingWithServiceResponseAsync(poolId, nodeId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> enableSchedulingWithServiceResponseAsync(String poolId, String nodeId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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 ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.enableScheduling(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = enableSchedulingDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @param computeNodeEnableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enableScheduling(String poolId, String nodeId, ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions) { + enableSchedulingWithServiceResponseAsync(poolId, nodeId, computeNodeEnableSchedulingOptions).toBlocking().single().body(); + } + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @param computeNodeEnableSchedulingOptions Additional parameters for the operation + * @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 enableSchedulingAsync(String poolId, String nodeId, ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(enableSchedulingWithServiceResponseAsync(poolId, nodeId, computeNodeEnableSchedulingOptions), serviceCallback); + } + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @param computeNodeEnableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable enableSchedulingAsync(String poolId, String nodeId, ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions) { + return enableSchedulingWithServiceResponseAsync(poolId, nodeId, computeNodeEnableSchedulingOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Enables task scheduling on the specified compute node. + * You can enable task scheduling on a node only if its current scheduling state is disabled. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node on which you want to enable task scheduling. + * @param computeNodeEnableSchedulingOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> enableSchedulingWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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(computeNodeEnableSchedulingOptions); + Integer timeout = null; + if (computeNodeEnableSchedulingOptions != null) { + timeout = computeNodeEnableSchedulingOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeEnableSchedulingOptions != null) { + clientRequestId = computeNodeEnableSchedulingOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeEnableSchedulingOptions != null) { + returnClientRequestId = computeNodeEnableSchedulingOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeEnableSchedulingOptions != null) { + ocpDate = computeNodeEnableSchedulingOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.enableScheduling(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = enableSchedulingDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders enableSchedulingDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeEnableSchedulingHeaders.class); + } + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ComputeNodeGetRemoteLoginSettingsResult object if successful. + */ + public ComputeNodeGetRemoteLoginSettingsResult getRemoteLoginSettings(String poolId, String nodeId) { + return getRemoteLoginSettingsWithServiceResponseAsync(poolId, nodeId).toBlocking().single().body(); + } + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @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 getRemoteLoginSettingsAsync(String poolId, String nodeId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getRemoteLoginSettingsWithServiceResponseAsync(poolId, nodeId), serviceCallback); + } + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNodeGetRemoteLoginSettingsResult object + */ + public Observable getRemoteLoginSettingsAsync(String poolId, String nodeId) { + return getRemoteLoginSettingsWithServiceResponseAsync(poolId, nodeId).map(new Func1, ComputeNodeGetRemoteLoginSettingsResult>() { + @Override + public ComputeNodeGetRemoteLoginSettingsResult call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNodeGetRemoteLoginSettingsResult object + */ + public Observable> getRemoteLoginSettingsWithServiceResponseAsync(String poolId, String nodeId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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 ComputeNodeGetRemoteLoginSettingsOptions computeNodeGetRemoteLoginSettingsOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.getRemoteLoginSettings(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getRemoteLoginSettingsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @param computeNodeGetRemoteLoginSettingsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ComputeNodeGetRemoteLoginSettingsResult object if successful. + */ + public ComputeNodeGetRemoteLoginSettingsResult getRemoteLoginSettings(String poolId, String nodeId, ComputeNodeGetRemoteLoginSettingsOptions computeNodeGetRemoteLoginSettingsOptions) { + return getRemoteLoginSettingsWithServiceResponseAsync(poolId, nodeId, computeNodeGetRemoteLoginSettingsOptions).toBlocking().single().body(); + } + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @param computeNodeGetRemoteLoginSettingsOptions Additional parameters for the operation + * @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 getRemoteLoginSettingsAsync(String poolId, String nodeId, ComputeNodeGetRemoteLoginSettingsOptions computeNodeGetRemoteLoginSettingsOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getRemoteLoginSettingsWithServiceResponseAsync(poolId, nodeId, computeNodeGetRemoteLoginSettingsOptions), serviceCallback); + } + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @param computeNodeGetRemoteLoginSettingsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNodeGetRemoteLoginSettingsResult object + */ + public Observable getRemoteLoginSettingsAsync(String poolId, String nodeId, ComputeNodeGetRemoteLoginSettingsOptions computeNodeGetRemoteLoginSettingsOptions) { + return getRemoteLoginSettingsWithServiceResponseAsync(poolId, nodeId, computeNodeGetRemoteLoginSettingsOptions).map(new Func1, ComputeNodeGetRemoteLoginSettingsResult>() { + @Override + public ComputeNodeGetRemoteLoginSettingsResult call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the settings required for remote login to a compute node. + * Before you can remotely login to a node using the remote login settings, you must create a user account on the node. This API can be invoked only on pools created with the virtual machine configuration property. For pools created with a cloud service configuration, see the GetRemoteDesktop API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which to obtain the remote login settings. + * @param computeNodeGetRemoteLoginSettingsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComputeNodeGetRemoteLoginSettingsResult object + */ + public Observable> getRemoteLoginSettingsWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeGetRemoteLoginSettingsOptions computeNodeGetRemoteLoginSettingsOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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(computeNodeGetRemoteLoginSettingsOptions); + Integer timeout = null; + if (computeNodeGetRemoteLoginSettingsOptions != null) { + timeout = computeNodeGetRemoteLoginSettingsOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeGetRemoteLoginSettingsOptions != null) { + clientRequestId = computeNodeGetRemoteLoginSettingsOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeGetRemoteLoginSettingsOptions != null) { + returnClientRequestId = computeNodeGetRemoteLoginSettingsOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeGetRemoteLoginSettingsOptions != null) { + ocpDate = computeNodeGetRemoteLoginSettingsOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.getRemoteLoginSettings(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getRemoteLoginSettingsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getRemoteLoginSettingsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeGetRemoteLoginSettingsHeaders.class); + } + + + + //CUSTOM METHOD + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @param outputStream The OutputStream object which data will be written to if successful. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getRemoteDesktop(String poolId, String nodeId, final OutputStream outputStream) { + getRemoteDesktopAsync(poolId, nodeId).doOnNext( + new Action1() { + @Override + public void call(InputStream input) { + byte[] data = new byte[4096]; + int nRead; + try { + while ((nRead = input.read(data, 0, data.length)) != -1) { + outputStream.write(data, 0, nRead); + } + outputStream.flush(); + } catch (IOException e) { + throw Exceptions.propagate(e); + } + } + }).toBlocking().single(); + } + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol 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 getRemoteDesktopAsync(String poolId, String nodeId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getRemoteDesktopWithServiceResponseAsync(poolId, nodeId), serviceCallback); + } + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable getRemoteDesktopAsync(String poolId, String nodeId) { + return getRemoteDesktopWithServiceResponseAsync(poolId, nodeId).map(new Func1, InputStream>() { + @Override + public InputStream call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable> getRemoteDesktopWithServiceResponseAsync(String poolId, String nodeId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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 ComputeNodeGetRemoteDesktopOptions computeNodeGetRemoteDesktopOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.getRemoteDesktop(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getRemoteDesktopDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + // CUSTOM METHOD + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @param computeNodeGetRemoteDesktopOptions Additional parameters for the operation + * @param outputStream The OutputStream object which data will be written to if successful. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getRemoteDesktop(String poolId, String nodeId, ComputeNodeGetRemoteDesktopOptions computeNodeGetRemoteDesktopOptions, final OutputStream outputStream) { + getRemoteDesktopAsync(poolId, nodeId, computeNodeGetRemoteDesktopOptions).doOnNext( + new Action1() { + @Override + public void call(InputStream input) { + byte[] data = new byte[4096]; + int nRead; + try { + while ((nRead = input.read(data, 0, data.length)) != -1) { + outputStream.write(data, 0, nRead); + } + outputStream.flush(); + } catch (IOException e) { + throw Exceptions.propagate(e); + } + } + }).toBlocking().single(); + } + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @param computeNodeGetRemoteDesktopOptions Additional parameters for the operation + * @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 getRemoteDesktopAsync(String poolId, String nodeId, ComputeNodeGetRemoteDesktopOptions computeNodeGetRemoteDesktopOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getRemoteDesktopWithServiceResponseAsync(poolId, nodeId, computeNodeGetRemoteDesktopOptions), serviceCallback); + } + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @param computeNodeGetRemoteDesktopOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable getRemoteDesktopAsync(String poolId, String nodeId, ComputeNodeGetRemoteDesktopOptions computeNodeGetRemoteDesktopOptions) { + return getRemoteDesktopWithServiceResponseAsync(poolId, nodeId, computeNodeGetRemoteDesktopOptions).map(new Func1, InputStream>() { + @Override + public InputStream call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the Remote Desktop Protocol file for the specified compute node. + * Before you can access a node by using the RDP file, you must create a user account on the node. This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual machine configuration, see the GetRemoteLoginSettings API. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file. + * @param computeNodeGetRemoteDesktopOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable> getRemoteDesktopWithServiceResponseAsync(String poolId, String nodeId, ComputeNodeGetRemoteDesktopOptions computeNodeGetRemoteDesktopOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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(computeNodeGetRemoteDesktopOptions); + Integer timeout = null; + if (computeNodeGetRemoteDesktopOptions != null) { + timeout = computeNodeGetRemoteDesktopOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeGetRemoteDesktopOptions != null) { + clientRequestId = computeNodeGetRemoteDesktopOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeGetRemoteDesktopOptions != null) { + returnClientRequestId = computeNodeGetRemoteDesktopOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeGetRemoteDesktopOptions != null) { + ocpDate = computeNodeGetRemoteDesktopOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.getRemoteDesktop(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getRemoteDesktopDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getRemoteDesktopDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeGetRemoteDesktopHeaders.class); + } + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UploadBatchServiceLogsResult object if successful. + */ + public UploadBatchServiceLogsResult uploadBatchServiceLogs(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration) { + return uploadBatchServiceLogsWithServiceResponseAsync(poolId, nodeId, uploadBatchServiceLogsConfiguration).toBlocking().single().body(); + } + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @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 uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(uploadBatchServiceLogsWithServiceResponseAsync(poolId, nodeId, uploadBatchServiceLogsConfiguration), serviceCallback); + } + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UploadBatchServiceLogsResult object + */ + public Observable uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration) { + return uploadBatchServiceLogsWithServiceResponseAsync(poolId, nodeId, uploadBatchServiceLogsConfiguration).map(new Func1, UploadBatchServiceLogsResult>() { + @Override + public UploadBatchServiceLogsResult call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UploadBatchServiceLogsResult object + */ + public Observable> uploadBatchServiceLogsWithServiceResponseAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (uploadBatchServiceLogsConfiguration == null) { + throw new IllegalArgumentException("Parameter uploadBatchServiceLogsConfiguration 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(uploadBatchServiceLogsConfiguration); + final ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.uploadBatchServiceLogs(poolId, nodeId, uploadBatchServiceLogsConfiguration, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = uploadBatchServiceLogsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @param computeNodeUploadBatchServiceLogsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UploadBatchServiceLogsResult object if successful. + */ + public UploadBatchServiceLogsResult uploadBatchServiceLogs(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions) { + return uploadBatchServiceLogsWithServiceResponseAsync(poolId, nodeId, uploadBatchServiceLogsConfiguration, computeNodeUploadBatchServiceLogsOptions).toBlocking().single().body(); + } + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @param computeNodeUploadBatchServiceLogsOptions Additional parameters for the operation + * @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 uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(uploadBatchServiceLogsWithServiceResponseAsync(poolId, nodeId, uploadBatchServiceLogsConfiguration, computeNodeUploadBatchServiceLogsOptions), serviceCallback); + } + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @param computeNodeUploadBatchServiceLogsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UploadBatchServiceLogsResult object + */ + public Observable uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions) { + return uploadBatchServiceLogsWithServiceResponseAsync(poolId, nodeId, uploadBatchServiceLogsConfiguration, computeNodeUploadBatchServiceLogsOptions).map(new Func1, UploadBatchServiceLogsResult>() { + @Override + public UploadBatchServiceLogsResult call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. + * This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. + * @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. + * @param computeNodeUploadBatchServiceLogsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UploadBatchServiceLogsResult object + */ + public Observable> uploadBatchServiceLogsWithServiceResponseAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (uploadBatchServiceLogsConfiguration == null) { + throw new IllegalArgumentException("Parameter uploadBatchServiceLogsConfiguration 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(uploadBatchServiceLogsConfiguration); + Validator.validate(computeNodeUploadBatchServiceLogsOptions); + Integer timeout = null; + if (computeNodeUploadBatchServiceLogsOptions != null) { + timeout = computeNodeUploadBatchServiceLogsOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeUploadBatchServiceLogsOptions != null) { + clientRequestId = computeNodeUploadBatchServiceLogsOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeUploadBatchServiceLogsOptions != null) { + returnClientRequestId = computeNodeUploadBatchServiceLogsOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeUploadBatchServiceLogsOptions != null) { + ocpDate = computeNodeUploadBatchServiceLogsOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.uploadBatchServiceLogs(poolId, nodeId, uploadBatchServiceLogsConfiguration, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = uploadBatchServiceLogsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders uploadBatchServiceLogsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeUploadBatchServiceLogsHeaders.class); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ComputeNode> object if successful. + */ + public PagedList list(final String poolId) { + ServiceResponseWithHeaders, ComputeNodeListHeaders> response = listSinglePageAsync(poolId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @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 poolId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(poolId), + new Func1, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + public Observable> listAsync(final String poolId) { + return listWithServiceResponseAsync(poolId) + .map(new Func1, ComputeNodeListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, ComputeNodeListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + public Observable, ComputeNodeListHeaders>> listWithServiceResponseAsync(final String poolId) { + return listSinglePageAsync(poolId) + .concatMap(new Func1, ComputeNodeListHeaders>, Observable, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(ServiceResponseWithHeaders, ComputeNodeListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ComputeNode> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, ComputeNodeListHeaders>> listSinglePageAsync(final String poolId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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 ComputeNodeListOptions computeNodeListOptions = null; + String filter = null; + String select = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(poolId, this.client.apiVersion(), this.client.acceptLanguage(), filter, select, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, ComputeNodeListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, ComputeNodeListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @param computeNodeListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ComputeNode> object if successful. + */ + public PagedList list(final String poolId, final ComputeNodeListOptions computeNodeListOptions) { + ServiceResponseWithHeaders, ComputeNodeListHeaders> response = listSinglePageAsync(poolId, computeNodeListOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + ComputeNodeListNextOptions computeNodeListNextOptions = null; + if (computeNodeListOptions != null) { + computeNodeListNextOptions = new ComputeNodeListNextOptions(); + computeNodeListNextOptions.withClientRequestId(computeNodeListOptions.clientRequestId()); + computeNodeListNextOptions.withReturnClientRequestId(computeNodeListOptions.returnClientRequestId()); + computeNodeListNextOptions.withOcpDate(computeNodeListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @param computeNodeListOptions Additional parameters for the operation + * @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 poolId, final ComputeNodeListOptions computeNodeListOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(poolId, computeNodeListOptions), + new Func1, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(String nextPageLink) { + ComputeNodeListNextOptions computeNodeListNextOptions = null; + if (computeNodeListOptions != null) { + computeNodeListNextOptions = new ComputeNodeListNextOptions(); + computeNodeListNextOptions.withClientRequestId(computeNodeListOptions.clientRequestId()); + computeNodeListNextOptions.withReturnClientRequestId(computeNodeListOptions.returnClientRequestId()); + computeNodeListNextOptions.withOcpDate(computeNodeListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @param computeNodeListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + public Observable> listAsync(final String poolId, final ComputeNodeListOptions computeNodeListOptions) { + return listWithServiceResponseAsync(poolId, computeNodeListOptions) + .map(new Func1, ComputeNodeListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, ComputeNodeListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param poolId The ID of the pool from which you want to list nodes. + * @param computeNodeListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + public Observable, ComputeNodeListHeaders>> listWithServiceResponseAsync(final String poolId, final ComputeNodeListOptions computeNodeListOptions) { + return listSinglePageAsync(poolId, computeNodeListOptions) + .concatMap(new Func1, ComputeNodeListHeaders>, Observable, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(ServiceResponseWithHeaders, ComputeNodeListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + ComputeNodeListNextOptions computeNodeListNextOptions = null; + if (computeNodeListOptions != null) { + computeNodeListNextOptions = new ComputeNodeListNextOptions(); + computeNodeListNextOptions.withClientRequestId(computeNodeListOptions.clientRequestId()); + computeNodeListNextOptions.withReturnClientRequestId(computeNodeListOptions.returnClientRequestId()); + computeNodeListNextOptions.withOcpDate(computeNodeListOptions.ocpDate()); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, computeNodeListNextOptions)); + } + }); + } + + /** + * Lists the compute nodes in the specified pool. + * + ServiceResponseWithHeaders, ComputeNodeListHeaders> * @param poolId The ID of the pool from which you want to list nodes. + ServiceResponseWithHeaders, ComputeNodeListHeaders> * @param computeNodeListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ComputeNode> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, ComputeNodeListHeaders>> listSinglePageAsync(final String poolId, final ComputeNodeListOptions computeNodeListOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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(computeNodeListOptions); + String filter = null; + if (computeNodeListOptions != null) { + filter = computeNodeListOptions.filter(); + } + String select = null; + if (computeNodeListOptions != null) { + select = computeNodeListOptions.select(); + } + Integer maxResults = null; + if (computeNodeListOptions != null) { + maxResults = computeNodeListOptions.maxResults(); + } + Integer timeout = null; + if (computeNodeListOptions != null) { + timeout = computeNodeListOptions.timeout(); + } + UUID clientRequestId = null; + if (computeNodeListOptions != null) { + clientRequestId = computeNodeListOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeListOptions != null) { + returnClientRequestId = computeNodeListOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeListOptions != null) { + ocpDate = computeNodeListOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(poolId, this.client.apiVersion(), this.client.acceptLanguage(), filter, select, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, ComputeNodeListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, ComputeNodeListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, ComputeNodeListHeaders> listDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeListHeaders.class); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ComputeNode> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponseWithHeaders, ComputeNodeListHeaders> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists the compute nodes in the specified pool. + * + * @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.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @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<ComputeNode> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, ComputeNodeListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, ComputeNodeListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @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<ComputeNode> object + */ + public Observable, ComputeNodeListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, ComputeNodeListHeaders>, Observable, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(ServiceResponseWithHeaders, ComputeNodeListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ComputeNode> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, ComputeNodeListHeaders>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final ComputeNodeListNextOptions computeNodeListNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, ComputeNodeListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, ComputeNodeListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param computeNodeListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<ComputeNode> object if successful. + */ + public PagedList listNext(final String nextPageLink, final ComputeNodeListNextOptions computeNodeListNextOptions) { + ServiceResponseWithHeaders, ComputeNodeListHeaders> response = listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param computeNodeListNextOptions Additional parameters for the 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 ComputeNodeListNextOptions computeNodeListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions), + new Func1, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param computeNodeListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + public Observable> listNextAsync(final String nextPageLink, final ComputeNodeListNextOptions computeNodeListNextOptions) { + return listNextWithServiceResponseAsync(nextPageLink, computeNodeListNextOptions) + .map(new Func1, ComputeNodeListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, ComputeNodeListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the compute nodes in the specified pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param computeNodeListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComputeNode> object + */ + public Observable, ComputeNodeListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final ComputeNodeListNextOptions computeNodeListNextOptions) { + return listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions) + .concatMap(new Func1, ComputeNodeListHeaders>, Observable, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(ServiceResponseWithHeaders, ComputeNodeListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, computeNodeListNextOptions)); + } + }); + } + + /** + * Lists the compute nodes in the specified pool. + * + ServiceResponseWithHeaders, ComputeNodeListHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, ComputeNodeListHeaders> * @param computeNodeListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ComputeNode> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, ComputeNodeListHeaders>> listNextSinglePageAsync(final String nextPageLink, final ComputeNodeListNextOptions computeNodeListNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(computeNodeListNextOptions); + UUID clientRequestId = null; + if (computeNodeListNextOptions != null) { + clientRequestId = computeNodeListNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (computeNodeListNextOptions != null) { + returnClientRequestId = computeNodeListNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (computeNodeListNextOptions != null) { + ocpDate = computeNodeListNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, ComputeNodeListHeaders>>>() { + @Override + public Observable, ComputeNodeListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, ComputeNodeListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, ComputeNodeListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, ComputeNodeListHeaders> listNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, ComputeNodeListHeaders.class); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java new file mode 100644 index 000000000000..d37358ced6e9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java @@ -0,0 +1,2711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.batch.protocol.Files; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.FileDeleteFromComputeNodeHeaders; +import com.microsoft.azure.batch.protocol.models.FileDeleteFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileDeleteFromTaskHeaders; +import com.microsoft.azure.batch.protocol.models.FileDeleteFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.FileGetFromComputeNodeHeaders; +import com.microsoft.azure.batch.protocol.models.FileGetFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileGetFromTaskHeaders; +import com.microsoft.azure.batch.protocol.models.FileGetFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromComputeNodeHeaders; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromTaskHeaders; +import com.microsoft.azure.batch.protocol.models.FileGetPropertiesFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.FileListFromComputeNodeHeaders; +import com.microsoft.azure.batch.protocol.models.FileListFromComputeNodeNextOptions; +import com.microsoft.azure.batch.protocol.models.FileListFromComputeNodeOptions; +import com.microsoft.azure.batch.protocol.models.FileListFromTaskHeaders; +import com.microsoft.azure.batch.protocol.models.FileListFromTaskNextOptions; +import com.microsoft.azure.batch.protocol.models.FileListFromTaskOptions; +import com.microsoft.azure.batch.protocol.models.NodeFile; +import com.microsoft.azure.batch.protocol.models.PageImpl; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.DateTimeRfc1123; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.InputStream; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Streaming; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +//Custom Imports +import java.io.OutputStream; +import rx.exceptions.Exceptions; +import rx.functions.Action1; + +/** + * An instance of this class provides access to all the operations defined + * in Files. + */ +public class FilesImpl implements Files { + /** The Retrofit service to perform REST calls. */ + private FilesService service; + /** The service client containing this operation class. */ + private BatchServiceClientImpl client; + + /** + * Initializes an instance of FilesImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FilesImpl(Retrofit retrofit, BatchServiceClientImpl client) { + this.service = retrofit.create(FilesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Files to be + * used by Retrofit to perform actually REST calls. + */ + interface FilesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Files deleteFromTask" }) + @HTTP(path = "jobs/{jobId}/tasks/{taskId}/files/{filePath}", method = "DELETE", hasBody = true) + Observable> deleteFromTask(@Path("jobId") String jobId, @Path("taskId") String taskId, @Path("filePath") String filePath, @Query("recursive") Boolean recursive, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Files getFromTask" }) + @GET("jobs/{jobId}/tasks/{taskId}/files/{filePath}") + @Streaming + Observable> getFromTask(@Path("jobId") String jobId, @Path("taskId") String taskId, @Path("filePath") String filePath, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("ocp-range") String ocpRange, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Files getPropertiesFromTask" }) + @HEAD("jobs/{jobId}/tasks/{taskId}/files/{filePath}") + Observable> getPropertiesFromTask(@Path("jobId") String jobId, @Path("taskId") String taskId, @Path("filePath") String filePath, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Files deleteFromComputeNode" }) + @HTTP(path = "pools/{poolId}/nodes/{nodeId}/files/{filePath}", method = "DELETE", hasBody = true) + Observable> deleteFromComputeNode(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Path("filePath") String filePath, @Query("recursive") Boolean recursive, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Files getFromComputeNode" }) + @GET("pools/{poolId}/nodes/{nodeId}/files/{filePath}") + @Streaming + Observable> getFromComputeNode(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Path("filePath") String filePath, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("ocp-range") String ocpRange, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Files getPropertiesFromComputeNode" }) + @HEAD("pools/{poolId}/nodes/{nodeId}/files/{filePath}") + Observable> getPropertiesFromComputeNode(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Path("filePath") String filePath, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Files listFromTask" }) + @GET("jobs/{jobId}/tasks/{taskId}/files") + Observable> listFromTask(@Path("jobId") String jobId, @Path("taskId") String taskId, @Query("recursive") Boolean recursive, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Files listFromComputeNode" }) + @GET("pools/{poolId}/nodes/{nodeId}/files") + Observable> listFromComputeNode(@Path("poolId") String poolId, @Path("nodeId") String nodeId, @Query("recursive") Boolean recursive, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Files listFromTaskNext" }) + @GET + Observable> listFromTaskNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Files listFromComputeNodeNext" }) + @GET + Observable> listFromComputeNodeNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to delete. + * @param filePath The path to the task file or directory that you want to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteFromTask(String jobId, String taskId, String filePath) { + deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath).toBlocking().single().body(); + } + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to delete. + * @param filePath The path to the task file or directory that you want 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 deleteFromTaskAsync(String jobId, String taskId, String filePath, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath), serviceCallback); + } + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to delete. + * @param filePath The path to the task file or directory that you want to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteFromTaskAsync(String jobId, String taskId, String filePath) { + return deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to delete. + * @param filePath The path to the task file or directory that you want to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteFromTaskWithServiceResponseAsync(String jobId, String taskId, String filePath) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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 Boolean recursive = null; + final FileDeleteFromTaskOptions fileDeleteFromTaskOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.deleteFromTask(jobId, taskId, filePath, recursive, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteFromTaskDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to delete. + * @param filePath The path to the task file or directory that you want to delete. + * @param recursive Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. + * @param fileDeleteFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteFromTask(String jobId, String taskId, String filePath, Boolean recursive, FileDeleteFromTaskOptions fileDeleteFromTaskOptions) { + deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath, recursive, fileDeleteFromTaskOptions).toBlocking().single().body(); + } + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to delete. + * @param filePath The path to the task file or directory that you want to delete. + * @param recursive Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. + * @param fileDeleteFromTaskOptions Additional parameters for the operation + * @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 deleteFromTaskAsync(String jobId, String taskId, String filePath, Boolean recursive, FileDeleteFromTaskOptions fileDeleteFromTaskOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath, recursive, fileDeleteFromTaskOptions), serviceCallback); + } + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to delete. + * @param filePath The path to the task file or directory that you want to delete. + * @param recursive Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. + * @param fileDeleteFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteFromTaskAsync(String jobId, String taskId, String filePath, Boolean recursive, FileDeleteFromTaskOptions fileDeleteFromTaskOptions) { + return deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath, recursive, fileDeleteFromTaskOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified task file from the compute node where the task ran. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to delete. + * @param filePath The path to the task file or directory that you want to delete. + * @param recursive Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. + * @param fileDeleteFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteFromTaskWithServiceResponseAsync(String jobId, String taskId, String filePath, Boolean recursive, FileDeleteFromTaskOptions fileDeleteFromTaskOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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(fileDeleteFromTaskOptions); + Integer timeout = null; + if (fileDeleteFromTaskOptions != null) { + timeout = fileDeleteFromTaskOptions.timeout(); + } + UUID clientRequestId = null; + if (fileDeleteFromTaskOptions != null) { + clientRequestId = fileDeleteFromTaskOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (fileDeleteFromTaskOptions != null) { + returnClientRequestId = fileDeleteFromTaskOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (fileDeleteFromTaskOptions != null) { + ocpDate = fileDeleteFromTaskOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.deleteFromTask(jobId, taskId, filePath, recursive, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteFromTaskDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders deleteFromTaskDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, FileDeleteFromTaskHeaders.class); + } + + // CUSTOM METHOD + /** + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to retrieve. + * @param filePath The path to the task file that you want to get the content of. + * @param outputStream The OutputStream object which data will be written to if successful. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getFromTask(String jobId, String taskId, String filePath, final OutputStream outputStream) { + getFromTaskAsync(jobId, taskId, filePath).doOnNext( + new Action1() { + @Override + public void call(InputStream input) { + byte[] data = new byte[4096]; + int nRead; + try { + while ((nRead = input.read(data, 0, data.length)) != -1) { + outputStream.write(data, 0, nRead); + } + outputStream.flush(); + } catch (IOException e) { + throw Exceptions.propagate(e); + } + } + }).toBlocking().single(); + } + + /** + * Returns the content of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to retrieve. + * @param filePath The path to the task file that you want to get the content of. + * @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 getFromTaskAsync(String jobId, String taskId, String filePath, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getFromTaskWithServiceResponseAsync(jobId, taskId, filePath), serviceCallback); + } + + /** + * Returns the content of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to retrieve. + * @param filePath The path to the task file that you want to get the content of. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable getFromTaskAsync(String jobId, String taskId, String filePath) { + return getFromTaskWithServiceResponseAsync(jobId, taskId, filePath).map(new Func1, InputStream>() { + @Override + public InputStream call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Returns the content of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to retrieve. + * @param filePath The path to the task file that you want to get the content of. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable> getFromTaskWithServiceResponseAsync(String jobId, String taskId, String filePath) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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 FileGetFromTaskOptions fileGetFromTaskOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ocpRange = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.getFromTask(jobId, taskId, filePath, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ocpRange, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getFromTaskDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + // CUSTOM METHOD + /** + * @param taskId The ID of the task whose file you want to retrieve. + * @param filePath The path to the task file that you want to get the content of. + * @param fileGetFromTaskOptions Additional parameters for the operation + * @param outputStream The OutputStream object which data will be written to if successful. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getFromTask(String jobId, String taskId, String filePath, FileGetFromTaskOptions fileGetFromTaskOptions, final OutputStream outputStream) { + getFromTaskAsync(jobId, taskId, filePath, fileGetFromTaskOptions).doOnNext( + new Action1() { + @Override + public void call(InputStream input) { + byte[] data = new byte[4096]; + int nRead; + try { + while ((nRead = input.read(data, 0, data.length)) != -1) { + outputStream.write(data, 0, nRead); + } + outputStream.flush(); + } catch (IOException e) { + throw Exceptions.propagate(e); + } + } + }).toBlocking().single(); + } + + /** + * Returns the content of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to retrieve. + * @param filePath The path to the task file that you want to get the content of. + * @param fileGetFromTaskOptions Additional parameters for the operation + * @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 getFromTaskAsync(String jobId, String taskId, String filePath, FileGetFromTaskOptions fileGetFromTaskOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getFromTaskWithServiceResponseAsync(jobId, taskId, filePath, fileGetFromTaskOptions), serviceCallback); + } + + /** + * Returns the content of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to retrieve. + * @param filePath The path to the task file that you want to get the content of. + * @param fileGetFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable getFromTaskAsync(String jobId, String taskId, String filePath, FileGetFromTaskOptions fileGetFromTaskOptions) { + return getFromTaskWithServiceResponseAsync(jobId, taskId, filePath, fileGetFromTaskOptions).map(new Func1, InputStream>() { + @Override + public InputStream call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Returns the content of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to retrieve. + * @param filePath The path to the task file that you want to get the content of. + * @param fileGetFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable> getFromTaskWithServiceResponseAsync(String jobId, String taskId, String filePath, FileGetFromTaskOptions fileGetFromTaskOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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(fileGetFromTaskOptions); + Integer timeout = null; + if (fileGetFromTaskOptions != null) { + timeout = fileGetFromTaskOptions.timeout(); + } + UUID clientRequestId = null; + if (fileGetFromTaskOptions != null) { + clientRequestId = fileGetFromTaskOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (fileGetFromTaskOptions != null) { + returnClientRequestId = fileGetFromTaskOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (fileGetFromTaskOptions != null) { + ocpDate = fileGetFromTaskOptions.ocpDate(); + } + String ocpRange = null; + if (fileGetFromTaskOptions != null) { + ocpRange = fileGetFromTaskOptions.ocpRange(); + } + DateTime ifModifiedSince = null; + if (fileGetFromTaskOptions != null) { + ifModifiedSince = fileGetFromTaskOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (fileGetFromTaskOptions != null) { + ifUnmodifiedSince = fileGetFromTaskOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.getFromTask(jobId, taskId, filePath, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ocpRange, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getFromTaskDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getFromTaskDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, FileGetFromTaskHeaders.class); + } + + /** + * Gets the properties of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to get the properties of. + * @param filePath The path to the task file that you want to get the properties of. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getPropertiesFromTask(String jobId, String taskId, String filePath) { + getPropertiesFromTaskWithServiceResponseAsync(jobId, taskId, filePath).toBlocking().single().body(); + } + + /** + * Gets the properties of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to get the properties of. + * @param filePath The path to the task file that you want to get the properties of. + * @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 getPropertiesFromTaskAsync(String jobId, String taskId, String filePath, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getPropertiesFromTaskWithServiceResponseAsync(jobId, taskId, filePath), serviceCallback); + } + + /** + * Gets the properties of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to get the properties of. + * @param filePath The path to the task file that you want to get the properties of. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getPropertiesFromTaskAsync(String jobId, String taskId, String filePath) { + return getPropertiesFromTaskWithServiceResponseAsync(jobId, taskId, filePath).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the properties of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to get the properties of. + * @param filePath The path to the task file that you want to get the properties of. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getPropertiesFromTaskWithServiceResponseAsync(String jobId, String taskId, String filePath) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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 FileGetPropertiesFromTaskOptions fileGetPropertiesFromTaskOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.getPropertiesFromTask(jobId, taskId, filePath, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getPropertiesFromTaskDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the properties of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to get the properties of. + * @param filePath The path to the task file that you want to get the properties of. + * @param fileGetPropertiesFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getPropertiesFromTask(String jobId, String taskId, String filePath, FileGetPropertiesFromTaskOptions fileGetPropertiesFromTaskOptions) { + getPropertiesFromTaskWithServiceResponseAsync(jobId, taskId, filePath, fileGetPropertiesFromTaskOptions).toBlocking().single().body(); + } + + /** + * Gets the properties of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to get the properties of. + * @param filePath The path to the task file that you want to get the properties of. + * @param fileGetPropertiesFromTaskOptions Additional parameters for the operation + * @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 getPropertiesFromTaskAsync(String jobId, String taskId, String filePath, FileGetPropertiesFromTaskOptions fileGetPropertiesFromTaskOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getPropertiesFromTaskWithServiceResponseAsync(jobId, taskId, filePath, fileGetPropertiesFromTaskOptions), serviceCallback); + } + + /** + * Gets the properties of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to get the properties of. + * @param filePath The path to the task file that you want to get the properties of. + * @param fileGetPropertiesFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getPropertiesFromTaskAsync(String jobId, String taskId, String filePath, FileGetPropertiesFromTaskOptions fileGetPropertiesFromTaskOptions) { + return getPropertiesFromTaskWithServiceResponseAsync(jobId, taskId, filePath, fileGetPropertiesFromTaskOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the properties of the specified task file. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose file you want to get the properties of. + * @param filePath The path to the task file that you want to get the properties of. + * @param fileGetPropertiesFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getPropertiesFromTaskWithServiceResponseAsync(String jobId, String taskId, String filePath, FileGetPropertiesFromTaskOptions fileGetPropertiesFromTaskOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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(fileGetPropertiesFromTaskOptions); + Integer timeout = null; + if (fileGetPropertiesFromTaskOptions != null) { + timeout = fileGetPropertiesFromTaskOptions.timeout(); + } + UUID clientRequestId = null; + if (fileGetPropertiesFromTaskOptions != null) { + clientRequestId = fileGetPropertiesFromTaskOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (fileGetPropertiesFromTaskOptions != null) { + returnClientRequestId = fileGetPropertiesFromTaskOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (fileGetPropertiesFromTaskOptions != null) { + ocpDate = fileGetPropertiesFromTaskOptions.ocpDate(); + } + DateTime ifModifiedSince = null; + if (fileGetPropertiesFromTaskOptions != null) { + ifModifiedSince = fileGetPropertiesFromTaskOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (fileGetPropertiesFromTaskOptions != null) { + ifUnmodifiedSince = fileGetPropertiesFromTaskOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.getPropertiesFromTask(jobId, taskId, filePath, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getPropertiesFromTaskDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getPropertiesFromTaskDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildEmptyWithHeaders(response, FileGetPropertiesFromTaskHeaders.class); + } + + /** + * Deletes the specified file from the compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to delete the file. + * @param filePath The path to the file or directory that you want to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteFromComputeNode(String poolId, String nodeId, String filePath) { + deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).toBlocking().single().body(); + } + + /** + * Deletes the specified file from the compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to delete the file. + * @param filePath The path to the file or directory that you want 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 deleteFromComputeNodeAsync(String poolId, String nodeId, String filePath, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath), serviceCallback); + } + + /** + * Deletes the specified file from the compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to delete the file. + * @param filePath The path to the file or directory that you want to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteFromComputeNodeAsync(String poolId, String nodeId, String filePath) { + return deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified file from the compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to delete the file. + * @param filePath The path to the file or directory that you want to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteFromComputeNodeWithServiceResponseAsync(String poolId, String nodeId, String filePath) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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 Boolean recursive = null; + final FileDeleteFromComputeNodeOptions fileDeleteFromComputeNodeOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.deleteFromComputeNode(poolId, nodeId, filePath, recursive, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteFromComputeNodeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes the specified file from the compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to delete the file. + * @param filePath The path to the file or directory that you want to delete. + * @param recursive Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. + * @param fileDeleteFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteFromComputeNode(String poolId, String nodeId, String filePath, Boolean recursive, FileDeleteFromComputeNodeOptions fileDeleteFromComputeNodeOptions) { + deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath, recursive, fileDeleteFromComputeNodeOptions).toBlocking().single().body(); + } + + /** + * Deletes the specified file from the compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to delete the file. + * @param filePath The path to the file or directory that you want to delete. + * @param recursive Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. + * @param fileDeleteFromComputeNodeOptions Additional parameters for the operation + * @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 deleteFromComputeNodeAsync(String poolId, String nodeId, String filePath, Boolean recursive, FileDeleteFromComputeNodeOptions fileDeleteFromComputeNodeOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath, recursive, fileDeleteFromComputeNodeOptions), serviceCallback); + } + + /** + * Deletes the specified file from the compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to delete the file. + * @param filePath The path to the file or directory that you want to delete. + * @param recursive Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. + * @param fileDeleteFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteFromComputeNodeAsync(String poolId, String nodeId, String filePath, Boolean recursive, FileDeleteFromComputeNodeOptions fileDeleteFromComputeNodeOptions) { + return deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath, recursive, fileDeleteFromComputeNodeOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified file from the compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node from which you want to delete the file. + * @param filePath The path to the file or directory that you want to delete. + * @param recursive Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. + * @param fileDeleteFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteFromComputeNodeWithServiceResponseAsync(String poolId, String nodeId, String filePath, Boolean recursive, FileDeleteFromComputeNodeOptions fileDeleteFromComputeNodeOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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(fileDeleteFromComputeNodeOptions); + Integer timeout = null; + if (fileDeleteFromComputeNodeOptions != null) { + timeout = fileDeleteFromComputeNodeOptions.timeout(); + } + UUID clientRequestId = null; + if (fileDeleteFromComputeNodeOptions != null) { + clientRequestId = fileDeleteFromComputeNodeOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (fileDeleteFromComputeNodeOptions != null) { + returnClientRequestId = fileDeleteFromComputeNodeOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (fileDeleteFromComputeNodeOptions != null) { + ocpDate = fileDeleteFromComputeNodeOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.deleteFromComputeNode(poolId, nodeId, filePath, recursive, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteFromComputeNodeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders deleteFromComputeNodeDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, FileDeleteFromComputeNodeHeaders.class); + } + + // CUSTOM METHOD + /** + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the content of. + * @param outputStream The OutputStream object which data will be written to if successful. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getFromComputeNode(String poolId, String nodeId, String filePath, final OutputStream outputStream) { + getFromComputeNodeAsync(poolId, nodeId, filePath).doOnNext( + new Action1() { + @Override + public void call(InputStream input) { + byte[] data = new byte[4096]; + int nRead; + try { + while ((nRead = input.read(data, 0, data.length)) != -1) { + outputStream.write(data, 0, nRead); + } + outputStream.flush(); + } catch (IOException e) { + throw Exceptions.propagate(e); + } + } + }).toBlocking().single(); + } + + /** + * Returns the content of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the content of. + * @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 getFromComputeNodeAsync(String poolId, String nodeId, String filePath, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath), serviceCallback); + } + + /** + * Returns the content of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the content of. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable getFromComputeNodeAsync(String poolId, String nodeId, String filePath) { + return getFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).map(new Func1, InputStream>() { + @Override + public InputStream call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Returns the content of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the content of. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable> getFromComputeNodeWithServiceResponseAsync(String poolId, String nodeId, String filePath) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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 FileGetFromComputeNodeOptions fileGetFromComputeNodeOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ocpRange = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.getFromComputeNode(poolId, nodeId, filePath, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ocpRange, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getFromComputeNodeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + // CUSTOM METHOD + /** + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the content of. + * @param fileGetFromComputeNodeOptions Additional parameters for the operation + * @param outputStream The OutputStream object which data will be written to if successful. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getFromComputeNode(String poolId, String nodeId, String filePath, FileGetFromComputeNodeOptions fileGetFromComputeNodeOptions, final OutputStream outputStream) { + getFromComputeNodeAsync(poolId, nodeId, filePath, fileGetFromComputeNodeOptions).doOnNext( + new Action1() { + @Override + public void call(InputStream input) { + byte[] data = new byte[4096]; + int nRead; + try { + while ((nRead = input.read(data, 0, data.length)) != -1) { + outputStream.write(data, 0, nRead); + } + outputStream.flush(); + } catch (IOException e) { + throw Exceptions.propagate(e); + } + } + }).toBlocking().single(); + } + + /** + * Returns the content of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the content of. + * @param fileGetFromComputeNodeOptions Additional parameters for the operation + * @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 getFromComputeNodeAsync(String poolId, String nodeId, String filePath, FileGetFromComputeNodeOptions fileGetFromComputeNodeOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath, fileGetFromComputeNodeOptions), serviceCallback); + } + + /** + * Returns the content of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the content of. + * @param fileGetFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable getFromComputeNodeAsync(String poolId, String nodeId, String filePath, FileGetFromComputeNodeOptions fileGetFromComputeNodeOptions) { + return getFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath, fileGetFromComputeNodeOptions).map(new Func1, InputStream>() { + @Override + public InputStream call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Returns the content of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the content of. + * @param fileGetFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable> getFromComputeNodeWithServiceResponseAsync(String poolId, String nodeId, String filePath, FileGetFromComputeNodeOptions fileGetFromComputeNodeOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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(fileGetFromComputeNodeOptions); + Integer timeout = null; + if (fileGetFromComputeNodeOptions != null) { + timeout = fileGetFromComputeNodeOptions.timeout(); + } + UUID clientRequestId = null; + if (fileGetFromComputeNodeOptions != null) { + clientRequestId = fileGetFromComputeNodeOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (fileGetFromComputeNodeOptions != null) { + returnClientRequestId = fileGetFromComputeNodeOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (fileGetFromComputeNodeOptions != null) { + ocpDate = fileGetFromComputeNodeOptions.ocpDate(); + } + String ocpRange = null; + if (fileGetFromComputeNodeOptions != null) { + ocpRange = fileGetFromComputeNodeOptions.ocpRange(); + } + DateTime ifModifiedSince = null; + if (fileGetFromComputeNodeOptions != null) { + ifModifiedSince = fileGetFromComputeNodeOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (fileGetFromComputeNodeOptions != null) { + ifUnmodifiedSince = fileGetFromComputeNodeOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.getFromComputeNode(poolId, nodeId, filePath, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ocpRange, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getFromComputeNodeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getFromComputeNodeDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, FileGetFromComputeNodeHeaders.class); + } + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the properties of. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getPropertiesFromComputeNode(String poolId, String nodeId, String filePath) { + getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).toBlocking().single().body(); + } + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the properties of. + * @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 getPropertiesFromComputeNodeAsync(String poolId, String nodeId, String filePath, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath), serviceCallback); + } + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the properties of. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getPropertiesFromComputeNodeAsync(String poolId, String nodeId, String filePath) { + return getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the properties of. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getPropertiesFromComputeNodeWithServiceResponseAsync(String poolId, String nodeId, String filePath) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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 FileGetPropertiesFromComputeNodeOptions fileGetPropertiesFromComputeNodeOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.getPropertiesFromComputeNode(poolId, nodeId, filePath, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getPropertiesFromComputeNodeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the properties of. + * @param fileGetPropertiesFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getPropertiesFromComputeNode(String poolId, String nodeId, String filePath, FileGetPropertiesFromComputeNodeOptions fileGetPropertiesFromComputeNodeOptions) { + getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath, fileGetPropertiesFromComputeNodeOptions).toBlocking().single().body(); + } + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the properties of. + * @param fileGetPropertiesFromComputeNodeOptions Additional parameters for the operation + * @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 getPropertiesFromComputeNodeAsync(String poolId, String nodeId, String filePath, FileGetPropertiesFromComputeNodeOptions fileGetPropertiesFromComputeNodeOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath, fileGetPropertiesFromComputeNodeOptions), serviceCallback); + } + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the properties of. + * @param fileGetPropertiesFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getPropertiesFromComputeNodeAsync(String poolId, String nodeId, String filePath, FileGetPropertiesFromComputeNodeOptions fileGetPropertiesFromComputeNodeOptions) { + return getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath, fileGetPropertiesFromComputeNodeOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the properties of the specified compute node file. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node that contains the file. + * @param filePath The path to the compute node file that you want to get the properties of. + * @param fileGetPropertiesFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getPropertiesFromComputeNodeWithServiceResponseAsync(String poolId, String nodeId, String filePath, FileGetPropertiesFromComputeNodeOptions fileGetPropertiesFromComputeNodeOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId is required and cannot be null."); + } + if (filePath == null) { + throw new IllegalArgumentException("Parameter filePath 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(fileGetPropertiesFromComputeNodeOptions); + Integer timeout = null; + if (fileGetPropertiesFromComputeNodeOptions != null) { + timeout = fileGetPropertiesFromComputeNodeOptions.timeout(); + } + UUID clientRequestId = null; + if (fileGetPropertiesFromComputeNodeOptions != null) { + clientRequestId = fileGetPropertiesFromComputeNodeOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (fileGetPropertiesFromComputeNodeOptions != null) { + returnClientRequestId = fileGetPropertiesFromComputeNodeOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (fileGetPropertiesFromComputeNodeOptions != null) { + ocpDate = fileGetPropertiesFromComputeNodeOptions.ocpDate(); + } + DateTime ifModifiedSince = null; + if (fileGetPropertiesFromComputeNodeOptions != null) { + ifModifiedSince = fileGetPropertiesFromComputeNodeOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (fileGetPropertiesFromComputeNodeOptions != null) { + ifUnmodifiedSince = fileGetPropertiesFromComputeNodeOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.getPropertiesFromComputeNode(poolId, nodeId, filePath, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getPropertiesFromComputeNodeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getPropertiesFromComputeNodeDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildEmptyWithHeaders(response, FileGetPropertiesFromComputeNodeHeaders.class); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose files you want to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeFile> object if successful. + */ + public PagedList listFromTask(final String jobId, final String taskId) { + ServiceResponseWithHeaders, FileListFromTaskHeaders> response = listFromTaskSinglePageAsync(jobId, taskId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listFromTaskNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose files you want 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> listFromTaskAsync(final String jobId, final String taskId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromTaskSinglePageAsync(jobId, taskId), + new Func1, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(String nextPageLink) { + return listFromTaskNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose files you want to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable> listFromTaskAsync(final String jobId, final String taskId) { + return listFromTaskWithServiceResponseAsync(jobId, taskId) + .map(new Func1, FileListFromTaskHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, FileListFromTaskHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose files you want to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable, FileListFromTaskHeaders>> listFromTaskWithServiceResponseAsync(final String jobId, final String taskId) { + return listFromTaskSinglePageAsync(jobId, taskId) + .concatMap(new Func1, FileListFromTaskHeaders>, Observable, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(ServiceResponseWithHeaders, FileListFromTaskHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listFromTaskNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose files you want to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeFile> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, FileListFromTaskHeaders>> listFromTaskSinglePageAsync(final String jobId, final String taskId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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 Boolean recursive = null; + final FileListFromTaskOptions fileListFromTaskOptions = null; + String filter = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listFromTask(jobId, taskId, recursive, this.client.apiVersion(), this.client.acceptLanguage(), filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, FileListFromTaskHeaders> result = listFromTaskDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, FileListFromTaskHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose files you want to list. + * @param recursive Whether to list children of the task directory. This parameter can be used in combination with the filter parameter to list specific type of files. + * @param fileListFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeFile> object if successful. + */ + public PagedList listFromTask(final String jobId, final String taskId, final Boolean recursive, final FileListFromTaskOptions fileListFromTaskOptions) { + ServiceResponseWithHeaders, FileListFromTaskHeaders> response = listFromTaskSinglePageAsync(jobId, taskId, recursive, fileListFromTaskOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + FileListFromTaskNextOptions fileListFromTaskNextOptions = null; + if (fileListFromTaskOptions != null) { + fileListFromTaskNextOptions = new FileListFromTaskNextOptions(); + fileListFromTaskNextOptions.withClientRequestId(fileListFromTaskOptions.clientRequestId()); + fileListFromTaskNextOptions.withReturnClientRequestId(fileListFromTaskOptions.returnClientRequestId()); + fileListFromTaskNextOptions.withOcpDate(fileListFromTaskOptions.ocpDate()); + } + return listFromTaskNextSinglePageAsync(nextPageLink, fileListFromTaskNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose files you want to list. + * @param recursive Whether to list children of the task directory. This parameter can be used in combination with the filter parameter to list specific type of files. + * @param fileListFromTaskOptions Additional parameters for the operation + * @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> listFromTaskAsync(final String jobId, final String taskId, final Boolean recursive, final FileListFromTaskOptions fileListFromTaskOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromTaskSinglePageAsync(jobId, taskId, recursive, fileListFromTaskOptions), + new Func1, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(String nextPageLink) { + FileListFromTaskNextOptions fileListFromTaskNextOptions = null; + if (fileListFromTaskOptions != null) { + fileListFromTaskNextOptions = new FileListFromTaskNextOptions(); + fileListFromTaskNextOptions.withClientRequestId(fileListFromTaskOptions.clientRequestId()); + fileListFromTaskNextOptions.withReturnClientRequestId(fileListFromTaskOptions.returnClientRequestId()); + fileListFromTaskNextOptions.withOcpDate(fileListFromTaskOptions.ocpDate()); + } + return listFromTaskNextSinglePageAsync(nextPageLink, fileListFromTaskNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose files you want to list. + * @param recursive Whether to list children of the task directory. This parameter can be used in combination with the filter parameter to list specific type of files. + * @param fileListFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable> listFromTaskAsync(final String jobId, final String taskId, final Boolean recursive, final FileListFromTaskOptions fileListFromTaskOptions) { + return listFromTaskWithServiceResponseAsync(jobId, taskId, recursive, fileListFromTaskOptions) + .map(new Func1, FileListFromTaskHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, FileListFromTaskHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task whose files you want to list. + * @param recursive Whether to list children of the task directory. This parameter can be used in combination with the filter parameter to list specific type of files. + * @param fileListFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable, FileListFromTaskHeaders>> listFromTaskWithServiceResponseAsync(final String jobId, final String taskId, final Boolean recursive, final FileListFromTaskOptions fileListFromTaskOptions) { + return listFromTaskSinglePageAsync(jobId, taskId, recursive, fileListFromTaskOptions) + .concatMap(new Func1, FileListFromTaskHeaders>, Observable, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(ServiceResponseWithHeaders, FileListFromTaskHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + FileListFromTaskNextOptions fileListFromTaskNextOptions = null; + if (fileListFromTaskOptions != null) { + fileListFromTaskNextOptions = new FileListFromTaskNextOptions(); + fileListFromTaskNextOptions.withClientRequestId(fileListFromTaskOptions.clientRequestId()); + fileListFromTaskNextOptions.withReturnClientRequestId(fileListFromTaskOptions.returnClientRequestId()); + fileListFromTaskNextOptions.withOcpDate(fileListFromTaskOptions.ocpDate()); + } + return Observable.just(page).concatWith(listFromTaskNextWithServiceResponseAsync(nextPageLink, fileListFromTaskNextOptions)); + } + }); + } + + /** + * Lists the files in a task's directory on its compute node. + * + ServiceResponseWithHeaders, FileListFromTaskHeaders> * @param jobId The ID of the job that contains the task. + ServiceResponseWithHeaders, FileListFromTaskHeaders> * @param taskId The ID of the task whose files you want to list. + ServiceResponseWithHeaders, FileListFromTaskHeaders> * @param recursive Whether to list children of the task directory. This parameter can be used in combination with the filter parameter to list specific type of files. + ServiceResponseWithHeaders, FileListFromTaskHeaders> * @param fileListFromTaskOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeFile> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, FileListFromTaskHeaders>> listFromTaskSinglePageAsync(final String jobId, final String taskId, final Boolean recursive, final FileListFromTaskOptions fileListFromTaskOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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(fileListFromTaskOptions); + String filter = null; + if (fileListFromTaskOptions != null) { + filter = fileListFromTaskOptions.filter(); + } + Integer maxResults = null; + if (fileListFromTaskOptions != null) { + maxResults = fileListFromTaskOptions.maxResults(); + } + Integer timeout = null; + if (fileListFromTaskOptions != null) { + timeout = fileListFromTaskOptions.timeout(); + } + UUID clientRequestId = null; + if (fileListFromTaskOptions != null) { + clientRequestId = fileListFromTaskOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (fileListFromTaskOptions != null) { + returnClientRequestId = fileListFromTaskOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (fileListFromTaskOptions != null) { + ocpDate = fileListFromTaskOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listFromTask(jobId, taskId, recursive, this.client.apiVersion(), this.client.acceptLanguage(), filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, FileListFromTaskHeaders> result = listFromTaskDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, FileListFromTaskHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, FileListFromTaskHeaders> listFromTaskDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, FileListFromTaskHeaders.class); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node whose files you want to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeFile> object if successful. + */ + public PagedList listFromComputeNode(final String poolId, final String nodeId) { + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> response = listFromComputeNodeSinglePageAsync(poolId, nodeId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listFromComputeNodeNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node whose files you want 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> listFromComputeNodeAsync(final String poolId, final String nodeId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromComputeNodeSinglePageAsync(poolId, nodeId), + new Func1, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(String nextPageLink) { + return listFromComputeNodeNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node whose files you want to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable> listFromComputeNodeAsync(final String poolId, final String nodeId) { + return listFromComputeNodeWithServiceResponseAsync(poolId, nodeId) + .map(new Func1, FileListFromComputeNodeHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node whose files you want to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeWithServiceResponseAsync(final String poolId, final String nodeId) { + return listFromComputeNodeSinglePageAsync(poolId, nodeId) + .concatMap(new Func1, FileListFromComputeNodeHeaders>, Observable, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node whose files you want to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeFile> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeSinglePageAsync(final String poolId, final String nodeId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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 Boolean recursive = null; + final FileListFromComputeNodeOptions fileListFromComputeNodeOptions = null; + String filter = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listFromComputeNode(poolId, nodeId, recursive, this.client.apiVersion(), this.client.acceptLanguage(), filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> result = listFromComputeNodeDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, FileListFromComputeNodeHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node whose files you want to list. + * @param recursive Whether to list children of a directory. + * @param fileListFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeFile> object if successful. + */ + public PagedList listFromComputeNode(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> response = listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; + if (fileListFromComputeNodeOptions != null) { + fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); + fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); + fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); + fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); + } + return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node whose files you want to list. + * @param recursive Whether to list children of a directory. + * @param fileListFromComputeNodeOptions Additional parameters for the operation + * @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> listFromComputeNodeAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions), + new Func1, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(String nextPageLink) { + FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; + if (fileListFromComputeNodeOptions != null) { + fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); + fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); + fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); + fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); + } + return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node whose files you want to list. + * @param recursive Whether to list children of a directory. + * @param fileListFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable> listFromComputeNodeAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { + return listFromComputeNodeWithServiceResponseAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions) + .map(new Func1, FileListFromComputeNodeHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param poolId The ID of the pool that contains the compute node. + * @param nodeId The ID of the compute node whose files you want to list. + * @param recursive Whether to list children of a directory. + * @param fileListFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeWithServiceResponseAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { + return listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions) + .concatMap(new Func1, FileListFromComputeNodeHeaders>, Observable, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; + if (fileListFromComputeNodeOptions != null) { + fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); + fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); + fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); + fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); + } + return Observable.just(page).concatWith(listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, fileListFromComputeNodeNextOptions)); + } + }); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> * @param poolId The ID of the pool that contains the compute node. + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> * @param nodeId The ID of the compute node whose files you want to list. + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> * @param recursive Whether to list children of a directory. + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> * @param fileListFromComputeNodeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeFile> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeSinglePageAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeId == null) { + throw new IllegalArgumentException("Parameter nodeId 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(fileListFromComputeNodeOptions); + String filter = null; + if (fileListFromComputeNodeOptions != null) { + filter = fileListFromComputeNodeOptions.filter(); + } + Integer maxResults = null; + if (fileListFromComputeNodeOptions != null) { + maxResults = fileListFromComputeNodeOptions.maxResults(); + } + Integer timeout = null; + if (fileListFromComputeNodeOptions != null) { + timeout = fileListFromComputeNodeOptions.timeout(); + } + UUID clientRequestId = null; + if (fileListFromComputeNodeOptions != null) { + clientRequestId = fileListFromComputeNodeOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (fileListFromComputeNodeOptions != null) { + returnClientRequestId = fileListFromComputeNodeOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (fileListFromComputeNodeOptions != null) { + ocpDate = fileListFromComputeNodeOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listFromComputeNode(poolId, nodeId, recursive, this.client.apiVersion(), this.client.acceptLanguage(), filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> result = listFromComputeNodeDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, FileListFromComputeNodeHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> listFromComputeNodeDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, FileListFromComputeNodeHeaders.class); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeFile> object if successful. + */ + public PagedList listFromTaskNext(final String nextPageLink) { + ServiceResponseWithHeaders, FileListFromTaskHeaders> response = listFromTaskNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listFromTaskNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @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> listFromTaskNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromTaskNextSinglePageAsync(nextPageLink), + new Func1, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(String nextPageLink) { + return listFromTaskNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @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<NodeFile> object + */ + public Observable> listFromTaskNextAsync(final String nextPageLink) { + return listFromTaskNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, FileListFromTaskHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, FileListFromTaskHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @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<NodeFile> object + */ + public Observable, FileListFromTaskHeaders>> listFromTaskNextWithServiceResponseAsync(final String nextPageLink) { + return listFromTaskNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, FileListFromTaskHeaders>, Observable, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(ServiceResponseWithHeaders, FileListFromTaskHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listFromTaskNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeFile> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, FileListFromTaskHeaders>> listFromTaskNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final FileListFromTaskNextOptions fileListFromTaskNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listFromTaskNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, FileListFromTaskHeaders> result = listFromTaskNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, FileListFromTaskHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param fileListFromTaskNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeFile> object if successful. + */ + public PagedList listFromTaskNext(final String nextPageLink, final FileListFromTaskNextOptions fileListFromTaskNextOptions) { + ServiceResponseWithHeaders, FileListFromTaskHeaders> response = listFromTaskNextSinglePageAsync(nextPageLink, fileListFromTaskNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listFromTaskNextSinglePageAsync(nextPageLink, fileListFromTaskNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param fileListFromTaskNextOptions Additional parameters for the 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> listFromTaskNextAsync(final String nextPageLink, final FileListFromTaskNextOptions fileListFromTaskNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromTaskNextSinglePageAsync(nextPageLink, fileListFromTaskNextOptions), + new Func1, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(String nextPageLink) { + return listFromTaskNextSinglePageAsync(nextPageLink, fileListFromTaskNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param fileListFromTaskNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable> listFromTaskNextAsync(final String nextPageLink, final FileListFromTaskNextOptions fileListFromTaskNextOptions) { + return listFromTaskNextWithServiceResponseAsync(nextPageLink, fileListFromTaskNextOptions) + .map(new Func1, FileListFromTaskHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, FileListFromTaskHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the files in a task's directory on its compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param fileListFromTaskNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable, FileListFromTaskHeaders>> listFromTaskNextWithServiceResponseAsync(final String nextPageLink, final FileListFromTaskNextOptions fileListFromTaskNextOptions) { + return listFromTaskNextSinglePageAsync(nextPageLink, fileListFromTaskNextOptions) + .concatMap(new Func1, FileListFromTaskHeaders>, Observable, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(ServiceResponseWithHeaders, FileListFromTaskHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listFromTaskNextWithServiceResponseAsync(nextPageLink, fileListFromTaskNextOptions)); + } + }); + } + + /** + * Lists the files in a task's directory on its compute node. + * + ServiceResponseWithHeaders, FileListFromTaskHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, FileListFromTaskHeaders> * @param fileListFromTaskNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeFile> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, FileListFromTaskHeaders>> listFromTaskNextSinglePageAsync(final String nextPageLink, final FileListFromTaskNextOptions fileListFromTaskNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(fileListFromTaskNextOptions); + UUID clientRequestId = null; + if (fileListFromTaskNextOptions != null) { + clientRequestId = fileListFromTaskNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (fileListFromTaskNextOptions != null) { + returnClientRequestId = fileListFromTaskNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (fileListFromTaskNextOptions != null) { + ocpDate = fileListFromTaskNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listFromTaskNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, FileListFromTaskHeaders>>>() { + @Override + public Observable, FileListFromTaskHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, FileListFromTaskHeaders> result = listFromTaskNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, FileListFromTaskHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, FileListFromTaskHeaders> listFromTaskNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, FileListFromTaskHeaders.class); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeFile> object if successful. + */ + public PagedList listFromComputeNodeNext(final String nextPageLink) { + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> response = listFromComputeNodeNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listFromComputeNodeNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @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> listFromComputeNodeNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromComputeNodeNextSinglePageAsync(nextPageLink), + new Func1, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(String nextPageLink) { + return listFromComputeNodeNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @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<NodeFile> object + */ + public Observable> listFromComputeNodeNextAsync(final String nextPageLink) { + return listFromComputeNodeNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, FileListFromComputeNodeHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @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<NodeFile> object + */ + public Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeNextWithServiceResponseAsync(final String nextPageLink) { + return listFromComputeNodeNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, FileListFromComputeNodeHeaders>, Observable, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeFile> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listFromComputeNodeNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> result = listFromComputeNodeNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, FileListFromComputeNodeHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param fileListFromComputeNodeNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<NodeFile> object if successful. + */ + public PagedList listFromComputeNodeNext(final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions) { + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> response = listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param fileListFromComputeNodeNextOptions Additional parameters for the 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> listFromComputeNodeNextAsync(final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions), + new Func1, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(String nextPageLink) { + return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param fileListFromComputeNodeNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable> listFromComputeNodeNextAsync(final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions) { + return listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, fileListFromComputeNodeNextOptions) + .map(new Func1, FileListFromComputeNodeHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param fileListFromComputeNodeNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeFile> object + */ + public Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeNextWithServiceResponseAsync(final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions) { + return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions) + .concatMap(new Func1, FileListFromComputeNodeHeaders>, Observable, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, fileListFromComputeNodeNextOptions)); + } + }); + } + + /** + * Lists all of the files in task directories on the specified compute node. + * + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> * @param fileListFromComputeNodeNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeFile> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, FileListFromComputeNodeHeaders>> listFromComputeNodeNextSinglePageAsync(final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(fileListFromComputeNodeNextOptions); + UUID clientRequestId = null; + if (fileListFromComputeNodeNextOptions != null) { + clientRequestId = fileListFromComputeNodeNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (fileListFromComputeNodeNextOptions != null) { + returnClientRequestId = fileListFromComputeNodeNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (fileListFromComputeNodeNextOptions != null) { + ocpDate = fileListFromComputeNodeNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listFromComputeNodeNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, FileListFromComputeNodeHeaders>>>() { + @Override + public Observable, FileListFromComputeNodeHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> result = listFromComputeNodeNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, FileListFromComputeNodeHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, FileListFromComputeNodeHeaders> listFromComputeNodeNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, FileListFromComputeNodeHeaders.class); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java new file mode 100644 index 000000000000..c07dbf0b305c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java @@ -0,0 +1,2704 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.batch.protocol.JobSchedules; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.CloudJobSchedule; +import com.microsoft.azure.batch.protocol.models.JobScheduleAddHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleAddOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleAddParameter; +import com.microsoft.azure.batch.protocol.models.JobScheduleDeleteHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleDeleteOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleDisableHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleDisableOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleEnableHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleEnableOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleExistsHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleExistsOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleGetHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleGetOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleListHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleListNextOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleListOptions; +import com.microsoft.azure.batch.protocol.models.JobSchedulePatchHeaders; +import com.microsoft.azure.batch.protocol.models.JobSchedulePatchOptions; +import com.microsoft.azure.batch.protocol.models.JobSchedulePatchParameter; +import com.microsoft.azure.batch.protocol.models.JobScheduleTerminateHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleTerminateOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleUpdateHeaders; +import com.microsoft.azure.batch.protocol.models.JobScheduleUpdateOptions; +import com.microsoft.azure.batch.protocol.models.JobScheduleUpdateParameter; +import com.microsoft.azure.batch.protocol.models.PageImpl; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.DateTimeRfc1123; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +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 JobSchedules. + */ +public class JobSchedulesImpl implements JobSchedules { + /** The Retrofit service to perform REST calls. */ + private JobSchedulesService service; + /** The service client containing this operation class. */ + private BatchServiceClientImpl client; + + /** + * Initializes an instance of JobSchedulesImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobSchedulesImpl(Retrofit retrofit, BatchServiceClientImpl client) { + this.service = retrofit.create(JobSchedulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobSchedules to be + * used by Retrofit to perform actually REST calls. + */ + interface JobSchedulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules exists" }) + @HEAD("jobschedules/{jobScheduleId}") + Observable> exists(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules delete" }) + @HTTP(path = "jobschedules/{jobScheduleId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules get" }) + @GET("jobschedules/{jobScheduleId}") + Observable> get(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$select") String select, @Query("$expand") String expand, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules patch" }) + @PATCH("jobschedules/{jobScheduleId}") + Observable> patch(@Path("jobScheduleId") String jobScheduleId, @Body JobSchedulePatchParameter jobSchedulePatchParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules update" }) + @PUT("jobschedules/{jobScheduleId}") + Observable> update(@Path("jobScheduleId") String jobScheduleId, @Body JobScheduleUpdateParameter jobScheduleUpdateParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules disable" }) + @POST("jobschedules/{jobScheduleId}/disable") + Observable> disable(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules enable" }) + @POST("jobschedules/{jobScheduleId}/enable") + Observable> enable(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules terminate" }) + @POST("jobschedules/{jobScheduleId}/terminate") + Observable> terminate(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules add" }) + @POST("jobschedules") + Observable> add(@Body JobScheduleAddParameter cloudJobSchedule, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules list" }) + @GET("jobschedules") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("$select") String select, @Query("$expand") String expand, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.JobSchedules listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + } + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean exists(String jobScheduleId) { + return existsWithServiceResponseAsync(jobScheduleId).toBlocking().single().body(); + } + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @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 existsAsync(String jobScheduleId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(existsWithServiceResponseAsync(jobScheduleId), serviceCallback); + } + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable existsAsync(String jobScheduleId) { + return existsWithServiceResponseAsync(jobScheduleId).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> existsWithServiceResponseAsync(String jobScheduleId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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 JobScheduleExistsOptions jobScheduleExistsOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.exists(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = existsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @param jobScheduleExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean exists(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions) { + return existsWithServiceResponseAsync(jobScheduleId, jobScheduleExistsOptions).toBlocking().single().body(); + } + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @param jobScheduleExistsOptions Additional parameters for the operation + * @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 existsAsync(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(existsWithServiceResponseAsync(jobScheduleId, jobScheduleExistsOptions), serviceCallback); + } + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @param jobScheduleExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable existsAsync(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions) { + return existsWithServiceResponseAsync(jobScheduleId, jobScheduleExistsOptions).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Checks the specified job schedule exists. + * + * @param jobScheduleId The ID of the job schedule which you want to check. + * @param jobScheduleExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> existsWithServiceResponseAsync(String jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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(jobScheduleExistsOptions); + Integer timeout = null; + if (jobScheduleExistsOptions != null) { + timeout = jobScheduleExistsOptions.timeout(); + } + UUID clientRequestId = null; + if (jobScheduleExistsOptions != null) { + clientRequestId = jobScheduleExistsOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobScheduleExistsOptions != null) { + returnClientRequestId = jobScheduleExistsOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobScheduleExistsOptions != null) { + ocpDate = jobScheduleExistsOptions.ocpDate(); + } + String ifMatch = null; + if (jobScheduleExistsOptions != null) { + ifMatch = jobScheduleExistsOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobScheduleExistsOptions != null) { + ifNoneMatch = jobScheduleExistsOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobScheduleExistsOptions != null) { + ifModifiedSince = jobScheduleExistsOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobScheduleExistsOptions != null) { + ifUnmodifiedSince = jobScheduleExistsOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.exists(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = existsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders existsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildEmptyWithHeaders(response, JobScheduleExistsHeaders.class); + } + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobScheduleId) { + deleteWithServiceResponseAsync(jobScheduleId).toBlocking().single().body(); + } + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule 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 jobScheduleId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(jobScheduleId), serviceCallback); + } + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteAsync(String jobScheduleId) { + return deleteWithServiceResponseAsync(jobScheduleId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String jobScheduleId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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 JobScheduleDeleteOptions jobScheduleDeleteOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.delete(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @param jobScheduleDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions) { + deleteWithServiceResponseAsync(jobScheduleId, jobScheduleDeleteOptions).toBlocking().single().body(); + } + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @param jobScheduleDeleteOptions Additional parameters for the operation + * @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 jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(jobScheduleId, jobScheduleDeleteOptions), serviceCallback); + } + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @param jobScheduleDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteAsync(String jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions) { + return deleteWithServiceResponseAsync(jobScheduleId, jobScheduleDeleteOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a job schedule from the specified account. + * When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics. + * + * @param jobScheduleId The ID of the job schedule to delete. + * @param jobScheduleDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String jobScheduleId, JobScheduleDeleteOptions jobScheduleDeleteOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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(jobScheduleDeleteOptions); + Integer timeout = null; + if (jobScheduleDeleteOptions != null) { + timeout = jobScheduleDeleteOptions.timeout(); + } + UUID clientRequestId = null; + if (jobScheduleDeleteOptions != null) { + clientRequestId = jobScheduleDeleteOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobScheduleDeleteOptions != null) { + returnClientRequestId = jobScheduleDeleteOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobScheduleDeleteOptions != null) { + ocpDate = jobScheduleDeleteOptions.ocpDate(); + } + String ifMatch = null; + if (jobScheduleDeleteOptions != null) { + ifMatch = jobScheduleDeleteOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobScheduleDeleteOptions != null) { + ifNoneMatch = jobScheduleDeleteOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobScheduleDeleteOptions != null) { + ifModifiedSince = jobScheduleDeleteOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobScheduleDeleteOptions != null) { + ifUnmodifiedSince = jobScheduleDeleteOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.delete(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders deleteDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobScheduleDeleteHeaders.class); + } + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudJobSchedule object if successful. + */ + public CloudJobSchedule get(String jobScheduleId) { + return getWithServiceResponseAsync(jobScheduleId).toBlocking().single().body(); + } + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @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 jobScheduleId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(jobScheduleId), serviceCallback); + } + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJobSchedule object + */ + public Observable getAsync(String jobScheduleId) { + return getWithServiceResponseAsync(jobScheduleId).map(new Func1, CloudJobSchedule>() { + @Override + public CloudJobSchedule call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJobSchedule object + */ + public Observable> getWithServiceResponseAsync(String jobScheduleId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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 JobScheduleGetOptions jobScheduleGetOptions = null; + String select = null; + String expand = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.get(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @param jobScheduleGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudJobSchedule object if successful. + */ + public CloudJobSchedule get(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions) { + return getWithServiceResponseAsync(jobScheduleId, jobScheduleGetOptions).toBlocking().single().body(); + } + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @param jobScheduleGetOptions Additional parameters for the operation + * @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 jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(jobScheduleId, jobScheduleGetOptions), serviceCallback); + } + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @param jobScheduleGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJobSchedule object + */ + public Observable getAsync(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions) { + return getWithServiceResponseAsync(jobScheduleId, jobScheduleGetOptions).map(new Func1, CloudJobSchedule>() { + @Override + public CloudJobSchedule call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule to get. + * @param jobScheduleGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJobSchedule object + */ + public Observable> getWithServiceResponseAsync(String jobScheduleId, JobScheduleGetOptions jobScheduleGetOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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(jobScheduleGetOptions); + String select = null; + if (jobScheduleGetOptions != null) { + select = jobScheduleGetOptions.select(); + } + String expand = null; + if (jobScheduleGetOptions != null) { + expand = jobScheduleGetOptions.expand(); + } + Integer timeout = null; + if (jobScheduleGetOptions != null) { + timeout = jobScheduleGetOptions.timeout(); + } + UUID clientRequestId = null; + if (jobScheduleGetOptions != null) { + clientRequestId = jobScheduleGetOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobScheduleGetOptions != null) { + returnClientRequestId = jobScheduleGetOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobScheduleGetOptions != null) { + ocpDate = jobScheduleGetOptions.ocpDate(); + } + String ifMatch = null; + if (jobScheduleGetOptions != null) { + ifMatch = jobScheduleGetOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobScheduleGetOptions != null) { + ifNoneMatch = jobScheduleGetOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobScheduleGetOptions != null) { + ifModifiedSince = jobScheduleGetOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobScheduleGetOptions != null) { + ifUnmodifiedSince = jobScheduleGetOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.get(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobScheduleGetHeaders.class); + } + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void patch(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter) { + patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter 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 patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter), serviceCallback); + } + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter) { + return patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> patchWithServiceResponseAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null."); + } + if (jobSchedulePatchParameter == null) { + throw new IllegalArgumentException("Parameter jobSchedulePatchParameter 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(jobSchedulePatchParameter); + final JobSchedulePatchOptions jobSchedulePatchOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.patch(jobScheduleId, jobSchedulePatchParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = patchDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @param jobSchedulePatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void patch(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions) { + patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter, jobSchedulePatchOptions).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @param jobSchedulePatchOptions Additional parameters for the operation + * @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 patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter, jobSchedulePatchOptions), serviceCallback); + } + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @param jobSchedulePatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions) { + return patchWithServiceResponseAsync(jobScheduleId, jobSchedulePatchParameter, jobSchedulePatchOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified job schedule. + * This replaces only the job schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobSchedulePatchParameter The parameters for the request. + * @param jobSchedulePatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> patchWithServiceResponseAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, JobSchedulePatchOptions jobSchedulePatchOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null."); + } + if (jobSchedulePatchParameter == null) { + throw new IllegalArgumentException("Parameter jobSchedulePatchParameter 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(jobSchedulePatchParameter); + Validator.validate(jobSchedulePatchOptions); + Integer timeout = null; + if (jobSchedulePatchOptions != null) { + timeout = jobSchedulePatchOptions.timeout(); + } + UUID clientRequestId = null; + if (jobSchedulePatchOptions != null) { + clientRequestId = jobSchedulePatchOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobSchedulePatchOptions != null) { + returnClientRequestId = jobSchedulePatchOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobSchedulePatchOptions != null) { + ocpDate = jobSchedulePatchOptions.ocpDate(); + } + String ifMatch = null; + if (jobSchedulePatchOptions != null) { + ifMatch = jobSchedulePatchOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobSchedulePatchOptions != null) { + ifNoneMatch = jobSchedulePatchOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobSchedulePatchOptions != null) { + ifModifiedSince = jobSchedulePatchOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobSchedulePatchOptions != null) { + ifUnmodifiedSince = jobSchedulePatchOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.patch(jobScheduleId, jobSchedulePatchParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = patchDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders patchDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobSchedulePatchHeaders.class); + } + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter) { + updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter 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 jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter), serviceCallback); + } + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter) { + return updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null."); + } + if (jobScheduleUpdateParameter == null) { + throw new IllegalArgumentException("Parameter jobScheduleUpdateParameter 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(jobScheduleUpdateParameter); + final JobScheduleUpdateOptions jobScheduleUpdateOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.update(jobScheduleId, jobScheduleUpdateParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @param jobScheduleUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions) { + updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter, jobScheduleUpdateOptions).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @param jobScheduleUpdateOptions Additional parameters for the operation + * @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 jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter, jobScheduleUpdateOptions), serviceCallback); + } + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @param jobScheduleUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions) { + return updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter, jobScheduleUpdateOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified job schedule. + * This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected. + * + * @param jobScheduleId The ID of the job schedule to update. + * @param jobScheduleUpdateParameter The parameters for the request. + * @param jobScheduleUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null."); + } + if (jobScheduleUpdateParameter == null) { + throw new IllegalArgumentException("Parameter jobScheduleUpdateParameter 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(jobScheduleUpdateParameter); + Validator.validate(jobScheduleUpdateOptions); + Integer timeout = null; + if (jobScheduleUpdateOptions != null) { + timeout = jobScheduleUpdateOptions.timeout(); + } + UUID clientRequestId = null; + if (jobScheduleUpdateOptions != null) { + clientRequestId = jobScheduleUpdateOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobScheduleUpdateOptions != null) { + returnClientRequestId = jobScheduleUpdateOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobScheduleUpdateOptions != null) { + ocpDate = jobScheduleUpdateOptions.ocpDate(); + } + String ifMatch = null; + if (jobScheduleUpdateOptions != null) { + ifMatch = jobScheduleUpdateOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobScheduleUpdateOptions != null) { + ifNoneMatch = jobScheduleUpdateOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobScheduleUpdateOptions != null) { + ifModifiedSince = jobScheduleUpdateOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobScheduleUpdateOptions != null) { + ifUnmodifiedSince = jobScheduleUpdateOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.update(jobScheduleId, jobScheduleUpdateParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders updateDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobScheduleUpdateHeaders.class); + } + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void disable(String jobScheduleId) { + disableWithServiceResponseAsync(jobScheduleId).toBlocking().single().body(); + } + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @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 disableAsync(String jobScheduleId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(disableWithServiceResponseAsync(jobScheduleId), serviceCallback); + } + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable disableAsync(String jobScheduleId) { + return disableWithServiceResponseAsync(jobScheduleId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> disableWithServiceResponseAsync(String jobScheduleId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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 JobScheduleDisableOptions jobScheduleDisableOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.disable(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = disableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @param jobScheduleDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void disable(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions) { + disableWithServiceResponseAsync(jobScheduleId, jobScheduleDisableOptions).toBlocking().single().body(); + } + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @param jobScheduleDisableOptions Additional parameters for the operation + * @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 disableAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(disableWithServiceResponseAsync(jobScheduleId, jobScheduleDisableOptions), serviceCallback); + } + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @param jobScheduleDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable disableAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions) { + return disableWithServiceResponseAsync(jobScheduleId, jobScheduleDisableOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Disables a job schedule. + * No new jobs will be created until the job schedule is enabled again. + * + * @param jobScheduleId The ID of the job schedule to disable. + * @param jobScheduleDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> disableWithServiceResponseAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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(jobScheduleDisableOptions); + Integer timeout = null; + if (jobScheduleDisableOptions != null) { + timeout = jobScheduleDisableOptions.timeout(); + } + UUID clientRequestId = null; + if (jobScheduleDisableOptions != null) { + clientRequestId = jobScheduleDisableOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobScheduleDisableOptions != null) { + returnClientRequestId = jobScheduleDisableOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobScheduleDisableOptions != null) { + ocpDate = jobScheduleDisableOptions.ocpDate(); + } + String ifMatch = null; + if (jobScheduleDisableOptions != null) { + ifMatch = jobScheduleDisableOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobScheduleDisableOptions != null) { + ifNoneMatch = jobScheduleDisableOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobScheduleDisableOptions != null) { + ifModifiedSince = jobScheduleDisableOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobScheduleDisableOptions != null) { + ifUnmodifiedSince = jobScheduleDisableOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.disable(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = disableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders disableDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobScheduleDisableHeaders.class); + } + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enable(String jobScheduleId) { + enableWithServiceResponseAsync(jobScheduleId).toBlocking().single().body(); + } + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @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 enableAsync(String jobScheduleId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(enableWithServiceResponseAsync(jobScheduleId), serviceCallback); + } + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable enableAsync(String jobScheduleId) { + return enableWithServiceResponseAsync(jobScheduleId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> enableWithServiceResponseAsync(String jobScheduleId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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 JobScheduleEnableOptions jobScheduleEnableOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.enable(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = enableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @param jobScheduleEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enable(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions) { + enableWithServiceResponseAsync(jobScheduleId, jobScheduleEnableOptions).toBlocking().single().body(); + } + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @param jobScheduleEnableOptions Additional parameters for the operation + * @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 enableAsync(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(enableWithServiceResponseAsync(jobScheduleId, jobScheduleEnableOptions), serviceCallback); + } + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @param jobScheduleEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable enableAsync(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions) { + return enableWithServiceResponseAsync(jobScheduleId, jobScheduleEnableOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Enables a job schedule. + * + * @param jobScheduleId The ID of the job schedule to enable. + * @param jobScheduleEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> enableWithServiceResponseAsync(String jobScheduleId, JobScheduleEnableOptions jobScheduleEnableOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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(jobScheduleEnableOptions); + Integer timeout = null; + if (jobScheduleEnableOptions != null) { + timeout = jobScheduleEnableOptions.timeout(); + } + UUID clientRequestId = null; + if (jobScheduleEnableOptions != null) { + clientRequestId = jobScheduleEnableOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobScheduleEnableOptions != null) { + returnClientRequestId = jobScheduleEnableOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobScheduleEnableOptions != null) { + ocpDate = jobScheduleEnableOptions.ocpDate(); + } + String ifMatch = null; + if (jobScheduleEnableOptions != null) { + ifMatch = jobScheduleEnableOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobScheduleEnableOptions != null) { + ifNoneMatch = jobScheduleEnableOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobScheduleEnableOptions != null) { + ifModifiedSince = jobScheduleEnableOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobScheduleEnableOptions != null) { + ifUnmodifiedSince = jobScheduleEnableOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.enable(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = enableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders enableDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobScheduleEnableHeaders.class); + } + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void terminate(String jobScheduleId) { + terminateWithServiceResponseAsync(jobScheduleId).toBlocking().single().body(); + } + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @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 terminateAsync(String jobScheduleId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(terminateWithServiceResponseAsync(jobScheduleId), serviceCallback); + } + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable terminateAsync(String jobScheduleId) { + return terminateWithServiceResponseAsync(jobScheduleId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> terminateWithServiceResponseAsync(String jobScheduleId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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 JobScheduleTerminateOptions jobScheduleTerminateOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.terminate(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = terminateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @param jobScheduleTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void terminate(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions) { + terminateWithServiceResponseAsync(jobScheduleId, jobScheduleTerminateOptions).toBlocking().single().body(); + } + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @param jobScheduleTerminateOptions Additional parameters for the operation + * @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 terminateAsync(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(terminateWithServiceResponseAsync(jobScheduleId, jobScheduleTerminateOptions), serviceCallback); + } + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @param jobScheduleTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable terminateAsync(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions) { + return terminateWithServiceResponseAsync(jobScheduleId, jobScheduleTerminateOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Terminates a job schedule. + * + * @param jobScheduleId The ID of the job schedule to terminates. + * @param jobScheduleTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> terminateWithServiceResponseAsync(String jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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(jobScheduleTerminateOptions); + Integer timeout = null; + if (jobScheduleTerminateOptions != null) { + timeout = jobScheduleTerminateOptions.timeout(); + } + UUID clientRequestId = null; + if (jobScheduleTerminateOptions != null) { + clientRequestId = jobScheduleTerminateOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobScheduleTerminateOptions != null) { + returnClientRequestId = jobScheduleTerminateOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobScheduleTerminateOptions != null) { + ocpDate = jobScheduleTerminateOptions.ocpDate(); + } + String ifMatch = null; + if (jobScheduleTerminateOptions != null) { + ifMatch = jobScheduleTerminateOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobScheduleTerminateOptions != null) { + ifNoneMatch = jobScheduleTerminateOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobScheduleTerminateOptions != null) { + ifModifiedSince = jobScheduleTerminateOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobScheduleTerminateOptions != null) { + ifUnmodifiedSince = jobScheduleTerminateOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.terminate(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = terminateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders terminateDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobScheduleTerminateHeaders.class); + } + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void add(JobScheduleAddParameter cloudJobSchedule) { + addWithServiceResponseAsync(cloudJobSchedule).toBlocking().single().body(); + } + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @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 addAsync(JobScheduleAddParameter cloudJobSchedule, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(cloudJobSchedule), serviceCallback); + } + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addAsync(JobScheduleAddParameter cloudJobSchedule) { + return addWithServiceResponseAsync(cloudJobSchedule).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addWithServiceResponseAsync(JobScheduleAddParameter cloudJobSchedule) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (cloudJobSchedule == null) { + throw new IllegalArgumentException("Parameter cloudJobSchedule 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(cloudJobSchedule); + final JobScheduleAddOptions jobScheduleAddOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.add(cloudJobSchedule, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @param jobScheduleAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void add(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions) { + addWithServiceResponseAsync(cloudJobSchedule, jobScheduleAddOptions).toBlocking().single().body(); + } + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @param jobScheduleAddOptions Additional parameters for the operation + * @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 addAsync(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(cloudJobSchedule, jobScheduleAddOptions), serviceCallback); + } + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @param jobScheduleAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addAsync(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions) { + return addWithServiceResponseAsync(cloudJobSchedule, jobScheduleAddOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a job schedule to the specified account. + * + * @param cloudJobSchedule The job schedule to be added. + * @param jobScheduleAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addWithServiceResponseAsync(JobScheduleAddParameter cloudJobSchedule, JobScheduleAddOptions jobScheduleAddOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (cloudJobSchedule == null) { + throw new IllegalArgumentException("Parameter cloudJobSchedule 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(cloudJobSchedule); + Validator.validate(jobScheduleAddOptions); + Integer timeout = null; + if (jobScheduleAddOptions != null) { + timeout = jobScheduleAddOptions.timeout(); + } + UUID clientRequestId = null; + if (jobScheduleAddOptions != null) { + clientRequestId = jobScheduleAddOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobScheduleAddOptions != null) { + returnClientRequestId = jobScheduleAddOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobScheduleAddOptions != null) { + ocpDate = jobScheduleAddOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.add(cloudJobSchedule, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders addDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobScheduleAddHeaders.class); + } + + /** + * Lists all of the job schedules in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJobSchedule> object if successful. + */ + public PagedList list() { + ServiceResponseWithHeaders, JobScheduleListHeaders> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the job schedules in the specified 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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(), + new Func1, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the job schedules in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1, JobScheduleListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobScheduleListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the job schedules in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + public Observable, JobScheduleListHeaders>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1, JobScheduleListHeaders>, Observable, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(ServiceResponseWithHeaders, JobScheduleListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the job schedules in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudJobSchedule> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobScheduleListHeaders>> listSinglePageAsync() { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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 JobScheduleListOptions jobScheduleListOptions = null; + String filter = null; + String select = null; + String expand = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobScheduleListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobScheduleListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the job schedules in the specified account. + * + * @param jobScheduleListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJobSchedule> object if successful. + */ + public PagedList list(final JobScheduleListOptions jobScheduleListOptions) { + ServiceResponseWithHeaders, JobScheduleListHeaders> response = listSinglePageAsync(jobScheduleListOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + JobScheduleListNextOptions jobScheduleListNextOptions = null; + if (jobScheduleListOptions != null) { + jobScheduleListNextOptions = new JobScheduleListNextOptions(); + jobScheduleListNextOptions.withClientRequestId(jobScheduleListOptions.clientRequestId()); + jobScheduleListNextOptions.withReturnClientRequestId(jobScheduleListOptions.returnClientRequestId()); + jobScheduleListNextOptions.withOcpDate(jobScheduleListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the job schedules in the specified account. + * + * @param jobScheduleListOptions Additional parameters for the operation + * @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 JobScheduleListOptions jobScheduleListOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(jobScheduleListOptions), + new Func1, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(String nextPageLink) { + JobScheduleListNextOptions jobScheduleListNextOptions = null; + if (jobScheduleListOptions != null) { + jobScheduleListNextOptions = new JobScheduleListNextOptions(); + jobScheduleListNextOptions.withClientRequestId(jobScheduleListOptions.clientRequestId()); + jobScheduleListNextOptions.withReturnClientRequestId(jobScheduleListOptions.returnClientRequestId()); + jobScheduleListNextOptions.withOcpDate(jobScheduleListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the job schedules in the specified account. + * + * @param jobScheduleListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + public Observable> listAsync(final JobScheduleListOptions jobScheduleListOptions) { + return listWithServiceResponseAsync(jobScheduleListOptions) + .map(new Func1, JobScheduleListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobScheduleListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the job schedules in the specified account. + * + * @param jobScheduleListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + public Observable, JobScheduleListHeaders>> listWithServiceResponseAsync(final JobScheduleListOptions jobScheduleListOptions) { + return listSinglePageAsync(jobScheduleListOptions) + .concatMap(new Func1, JobScheduleListHeaders>, Observable, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(ServiceResponseWithHeaders, JobScheduleListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + JobScheduleListNextOptions jobScheduleListNextOptions = null; + if (jobScheduleListOptions != null) { + jobScheduleListNextOptions = new JobScheduleListNextOptions(); + jobScheduleListNextOptions.withClientRequestId(jobScheduleListOptions.clientRequestId()); + jobScheduleListNextOptions.withReturnClientRequestId(jobScheduleListOptions.returnClientRequestId()); + jobScheduleListNextOptions.withOcpDate(jobScheduleListOptions.ocpDate()); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions)); + } + }); + } + + /** + * Lists all of the job schedules in the specified account. + * + ServiceResponseWithHeaders, JobScheduleListHeaders> * @param jobScheduleListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudJobSchedule> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobScheduleListHeaders>> listSinglePageAsync(final JobScheduleListOptions jobScheduleListOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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(jobScheduleListOptions); + String filter = null; + if (jobScheduleListOptions != null) { + filter = jobScheduleListOptions.filter(); + } + String select = null; + if (jobScheduleListOptions != null) { + select = jobScheduleListOptions.select(); + } + String expand = null; + if (jobScheduleListOptions != null) { + expand = jobScheduleListOptions.expand(); + } + Integer maxResults = null; + if (jobScheduleListOptions != null) { + maxResults = jobScheduleListOptions.maxResults(); + } + Integer timeout = null; + if (jobScheduleListOptions != null) { + timeout = jobScheduleListOptions.timeout(); + } + UUID clientRequestId = null; + if (jobScheduleListOptions != null) { + clientRequestId = jobScheduleListOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobScheduleListOptions != null) { + returnClientRequestId = jobScheduleListOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobScheduleListOptions != null) { + ocpDate = jobScheduleListOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobScheduleListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobScheduleListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, JobScheduleListHeaders> listDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobScheduleListHeaders.class); + } + + /** + * Lists all of the job schedules 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 BatchErrorException 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<CloudJobSchedule> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponseWithHeaders, JobScheduleListHeaders> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the job schedules 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.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the job schedules 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<CloudJobSchedule> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, JobScheduleListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobScheduleListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the job schedules 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<CloudJobSchedule> object + */ + public Observable, JobScheduleListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, JobScheduleListHeaders>, Observable, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(ServiceResponseWithHeaders, JobScheduleListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the job schedules 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 PagedList<CloudJobSchedule> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobScheduleListHeaders>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final JobScheduleListNextOptions jobScheduleListNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobScheduleListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobScheduleListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the job schedules in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobScheduleListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJobSchedule> object if successful. + */ + public PagedList listNext(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) { + ServiceResponseWithHeaders, JobScheduleListHeaders> response = listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the job schedules in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobScheduleListNextOptions Additional parameters for the 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 JobScheduleListNextOptions jobScheduleListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions), + new Func1, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the job schedules in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobScheduleListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + public Observable> listNextAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) { + return listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions) + .map(new Func1, JobScheduleListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobScheduleListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the job schedules in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobScheduleListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJobSchedule> object + */ + public Observable, JobScheduleListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) { + return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions) + .concatMap(new Func1, JobScheduleListHeaders>, Observable, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(ServiceResponseWithHeaders, JobScheduleListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions)); + } + }); + } + + /** + * Lists all of the job schedules in the specified account. + * + ServiceResponseWithHeaders, JobScheduleListHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, JobScheduleListHeaders> * @param jobScheduleListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudJobSchedule> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobScheduleListHeaders>> listNextSinglePageAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(jobScheduleListNextOptions); + UUID clientRequestId = null; + if (jobScheduleListNextOptions != null) { + clientRequestId = jobScheduleListNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobScheduleListNextOptions != null) { + returnClientRequestId = jobScheduleListNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobScheduleListNextOptions != null) { + ocpDate = jobScheduleListNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, JobScheduleListHeaders>>>() { + @Override + public Observable, JobScheduleListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobScheduleListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobScheduleListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, JobScheduleListHeaders> listNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobScheduleListHeaders.class); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java new file mode 100644 index 000000000000..9aa1bf6384c7 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java @@ -0,0 +1,4050 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.batch.protocol.Jobs; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.CloudJob; +import com.microsoft.azure.batch.protocol.models.DisableJobOption; +import com.microsoft.azure.batch.protocol.models.JobAddHeaders; +import com.microsoft.azure.batch.protocol.models.JobAddOptions; +import com.microsoft.azure.batch.protocol.models.JobAddParameter; +import com.microsoft.azure.batch.protocol.models.JobDeleteHeaders; +import com.microsoft.azure.batch.protocol.models.JobDeleteOptions; +import com.microsoft.azure.batch.protocol.models.JobDisableHeaders; +import com.microsoft.azure.batch.protocol.models.JobDisableOptions; +import com.microsoft.azure.batch.protocol.models.JobDisableParameter; +import com.microsoft.azure.batch.protocol.models.JobEnableHeaders; +import com.microsoft.azure.batch.protocol.models.JobEnableOptions; +import com.microsoft.azure.batch.protocol.models.JobGetAllLifetimeStatisticsHeaders; +import com.microsoft.azure.batch.protocol.models.JobGetAllLifetimeStatisticsOptions; +import com.microsoft.azure.batch.protocol.models.JobGetHeaders; +import com.microsoft.azure.batch.protocol.models.JobGetOptions; +import com.microsoft.azure.batch.protocol.models.JobGetTaskCountsHeaders; +import com.microsoft.azure.batch.protocol.models.JobGetTaskCountsOptions; +import com.microsoft.azure.batch.protocol.models.JobListFromJobScheduleHeaders; +import com.microsoft.azure.batch.protocol.models.JobListFromJobScheduleNextOptions; +import com.microsoft.azure.batch.protocol.models.JobListFromJobScheduleOptions; +import com.microsoft.azure.batch.protocol.models.JobListHeaders; +import com.microsoft.azure.batch.protocol.models.JobListNextOptions; +import com.microsoft.azure.batch.protocol.models.JobListOptions; +import com.microsoft.azure.batch.protocol.models.JobListPreparationAndReleaseTaskStatusHeaders; +import com.microsoft.azure.batch.protocol.models.JobListPreparationAndReleaseTaskStatusNextOptions; +import com.microsoft.azure.batch.protocol.models.JobListPreparationAndReleaseTaskStatusOptions; +import com.microsoft.azure.batch.protocol.models.JobPatchHeaders; +import com.microsoft.azure.batch.protocol.models.JobPatchOptions; +import com.microsoft.azure.batch.protocol.models.JobPatchParameter; +import com.microsoft.azure.batch.protocol.models.JobPreparationAndReleaseTaskExecutionInformation; +import com.microsoft.azure.batch.protocol.models.JobStatistics; +import com.microsoft.azure.batch.protocol.models.JobTerminateHeaders; +import com.microsoft.azure.batch.protocol.models.JobTerminateOptions; +import com.microsoft.azure.batch.protocol.models.JobTerminateParameter; +import com.microsoft.azure.batch.protocol.models.JobUpdateHeaders; +import com.microsoft.azure.batch.protocol.models.JobUpdateOptions; +import com.microsoft.azure.batch.protocol.models.JobUpdateParameter; +import com.microsoft.azure.batch.protocol.models.PageImpl; +import com.microsoft.azure.batch.protocol.models.TaskCounts; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.DateTimeRfc1123; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +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 Jobs. + */ +public class JobsImpl implements Jobs { + /** The Retrofit service to perform REST calls. */ + private JobsService service; + /** The service client containing this operation class. */ + private BatchServiceClientImpl client; + + /** + * Initializes an instance of JobsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobsImpl(Retrofit retrofit, BatchServiceClientImpl client) { + this.service = retrofit.create(JobsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Jobs to be + * used by Retrofit to perform actually REST calls. + */ + interface JobsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs getAllLifetimeStatistics" }) + @GET("lifetimejobstats") + Observable> getAllLifetimeStatistics(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs delete" }) + @HTTP(path = "jobs/{jobId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("jobId") String jobId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs get" }) + @GET("jobs/{jobId}") + Observable> get(@Path("jobId") String jobId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$select") String select, @Query("$expand") String expand, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs patch" }) + @PATCH("jobs/{jobId}") + Observable> patch(@Path("jobId") String jobId, @Body JobPatchParameter jobPatchParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs update" }) + @PUT("jobs/{jobId}") + Observable> update(@Path("jobId") String jobId, @Body JobUpdateParameter jobUpdateParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs disable" }) + @POST("jobs/{jobId}/disable") + Observable> disable(@Path("jobId") String jobId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Body JobDisableParameter jobDisableParameter, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs enable" }) + @POST("jobs/{jobId}/enable") + Observable> enable(@Path("jobId") String jobId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs terminate" }) + @POST("jobs/{jobId}/terminate") + Observable> terminate(@Path("jobId") String jobId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Body JobTerminateParameter jobTerminateParameter, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs add" }) + @POST("jobs") + Observable> add(@Body JobAddParameter job, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs list" }) + @GET("jobs") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("$select") String select, @Query("$expand") String expand, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs listFromJobSchedule" }) + @GET("jobschedules/{jobScheduleId}/jobs") + Observable> listFromJobSchedule(@Path("jobScheduleId") String jobScheduleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("$select") String select, @Query("$expand") String expand, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs listPreparationAndReleaseTaskStatus" }) + @GET("jobs/{jobId}/jobpreparationandreleasetaskstatus") + Observable> listPreparationAndReleaseTaskStatus(@Path("jobId") String jobId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("$select") String select, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs getTaskCounts" }) + @GET("jobs/{jobId}/taskcounts") + Observable> getTaskCounts(@Path("jobId") String jobId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs listFromJobScheduleNext" }) + @GET + Observable> listFromJobScheduleNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Jobs listPreparationAndReleaseTaskStatusNext" }) + @GET + Observable> listPreparationAndReleaseTaskStatusNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + } + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the JobStatistics object if successful. + */ + public JobStatistics getAllLifetimeStatistics() { + return getAllLifetimeStatisticsWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @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 getAllLifetimeStatisticsAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getAllLifetimeStatisticsWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStatistics object + */ + public Observable getAllLifetimeStatisticsAsync() { + return getAllLifetimeStatisticsWithServiceResponseAsync().map(new Func1, JobStatistics>() { + @Override + public JobStatistics call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStatistics object + */ + public Observable> getAllLifetimeStatisticsWithServiceResponseAsync() { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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 JobGetAllLifetimeStatisticsOptions jobGetAllLifetimeStatisticsOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.getAllLifetimeStatistics(this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getAllLifetimeStatisticsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param jobGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the JobStatistics object if successful. + */ + public JobStatistics getAllLifetimeStatistics(JobGetAllLifetimeStatisticsOptions jobGetAllLifetimeStatisticsOptions) { + return getAllLifetimeStatisticsWithServiceResponseAsync(jobGetAllLifetimeStatisticsOptions).toBlocking().single().body(); + } + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param jobGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @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 getAllLifetimeStatisticsAsync(JobGetAllLifetimeStatisticsOptions jobGetAllLifetimeStatisticsOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getAllLifetimeStatisticsWithServiceResponseAsync(jobGetAllLifetimeStatisticsOptions), serviceCallback); + } + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param jobGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStatistics object + */ + public Observable getAllLifetimeStatisticsAsync(JobGetAllLifetimeStatisticsOptions jobGetAllLifetimeStatisticsOptions) { + return getAllLifetimeStatisticsWithServiceResponseAsync(jobGetAllLifetimeStatisticsOptions).map(new Func1, JobStatistics>() { + @Override + public JobStatistics call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets lifetime summary statistics for all of the jobs in the specified account. + * Statistics are aggregated across all jobs that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param jobGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStatistics object + */ + public Observable> getAllLifetimeStatisticsWithServiceResponseAsync(JobGetAllLifetimeStatisticsOptions jobGetAllLifetimeStatisticsOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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(jobGetAllLifetimeStatisticsOptions); + Integer timeout = null; + if (jobGetAllLifetimeStatisticsOptions != null) { + timeout = jobGetAllLifetimeStatisticsOptions.timeout(); + } + UUID clientRequestId = null; + if (jobGetAllLifetimeStatisticsOptions != null) { + clientRequestId = jobGetAllLifetimeStatisticsOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobGetAllLifetimeStatisticsOptions != null) { + returnClientRequestId = jobGetAllLifetimeStatisticsOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobGetAllLifetimeStatisticsOptions != null) { + ocpDate = jobGetAllLifetimeStatisticsOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.getAllLifetimeStatistics(this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getAllLifetimeStatisticsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getAllLifetimeStatisticsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobGetAllLifetimeStatisticsHeaders.class); + } + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobId) { + deleteWithServiceResponseAsync(jobId).toBlocking().single().body(); + } + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job 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 jobId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(jobId), serviceCallback); + } + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteAsync(String jobId) { + return deleteWithServiceResponseAsync(jobId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String jobId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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 JobDeleteOptions jobDeleteOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.delete(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @param jobDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobId, JobDeleteOptions jobDeleteOptions) { + deleteWithServiceResponseAsync(jobId, jobDeleteOptions).toBlocking().single().body(); + } + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @param jobDeleteOptions Additional parameters for the operation + * @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 jobId, JobDeleteOptions jobDeleteOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(jobId, jobDeleteOptions), serviceCallback); + } + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @param jobDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteAsync(String jobId, JobDeleteOptions jobDeleteOptions) { + return deleteWithServiceResponseAsync(jobId, jobDeleteOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a job. + * Deleting a job also deletes all tasks that are part of that job, and all job statistics. This also overrides the retention period for task data; that is, if the job contains tasks which are still retained on compute nodes, the Batch services deletes those tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the job to the deleting state. All update operations on a job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the job is being deleted. + * + * @param jobId The ID of the job to delete. + * @param jobDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String jobId, JobDeleteOptions jobDeleteOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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(jobDeleteOptions); + Integer timeout = null; + if (jobDeleteOptions != null) { + timeout = jobDeleteOptions.timeout(); + } + UUID clientRequestId = null; + if (jobDeleteOptions != null) { + clientRequestId = jobDeleteOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobDeleteOptions != null) { + returnClientRequestId = jobDeleteOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobDeleteOptions != null) { + ocpDate = jobDeleteOptions.ocpDate(); + } + String ifMatch = null; + if (jobDeleteOptions != null) { + ifMatch = jobDeleteOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobDeleteOptions != null) { + ifNoneMatch = jobDeleteOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobDeleteOptions != null) { + ifModifiedSince = jobDeleteOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobDeleteOptions != null) { + ifUnmodifiedSince = jobDeleteOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.delete(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders deleteDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobDeleteHeaders.class); + } + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudJob object if successful. + */ + public CloudJob get(String jobId) { + return getWithServiceResponseAsync(jobId).toBlocking().single().body(); + } + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @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 jobId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(jobId), serviceCallback); + } + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJob object + */ + public Observable getAsync(String jobId) { + return getWithServiceResponseAsync(jobId).map(new Func1, CloudJob>() { + @Override + public CloudJob call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJob object + */ + public Observable> getWithServiceResponseAsync(String jobId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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 JobGetOptions jobGetOptions = null; + String select = null; + String expand = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.get(jobId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @param jobGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudJob object if successful. + */ + public CloudJob get(String jobId, JobGetOptions jobGetOptions) { + return getWithServiceResponseAsync(jobId, jobGetOptions).toBlocking().single().body(); + } + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @param jobGetOptions Additional parameters for the operation + * @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 jobId, JobGetOptions jobGetOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(jobId, jobGetOptions), serviceCallback); + } + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @param jobGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJob object + */ + public Observable getAsync(String jobId, JobGetOptions jobGetOptions) { + return getWithServiceResponseAsync(jobId, jobGetOptions).map(new Func1, CloudJob>() { + @Override + public CloudJob call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified job. + * + * @param jobId The ID of the job. + * @param jobGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudJob object + */ + public Observable> getWithServiceResponseAsync(String jobId, JobGetOptions jobGetOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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(jobGetOptions); + String select = null; + if (jobGetOptions != null) { + select = jobGetOptions.select(); + } + String expand = null; + if (jobGetOptions != null) { + expand = jobGetOptions.expand(); + } + Integer timeout = null; + if (jobGetOptions != null) { + timeout = jobGetOptions.timeout(); + } + UUID clientRequestId = null; + if (jobGetOptions != null) { + clientRequestId = jobGetOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobGetOptions != null) { + returnClientRequestId = jobGetOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobGetOptions != null) { + ocpDate = jobGetOptions.ocpDate(); + } + String ifMatch = null; + if (jobGetOptions != null) { + ifMatch = jobGetOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobGetOptions != null) { + ifNoneMatch = jobGetOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobGetOptions != null) { + ifModifiedSince = jobGetOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobGetOptions != null) { + ifUnmodifiedSince = jobGetOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.get(jobId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobGetHeaders.class); + } + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void patch(String jobId, JobPatchParameter jobPatchParameter) { + patchWithServiceResponseAsync(jobId, jobPatchParameter).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter 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 patchAsync(String jobId, JobPatchParameter jobPatchParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(patchWithServiceResponseAsync(jobId, jobPatchParameter), serviceCallback); + } + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable patchAsync(String jobId, JobPatchParameter jobPatchParameter) { + return patchWithServiceResponseAsync(jobId, jobPatchParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> patchWithServiceResponseAsync(String jobId, JobPatchParameter jobPatchParameter) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (jobPatchParameter == null) { + throw new IllegalArgumentException("Parameter jobPatchParameter 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(jobPatchParameter); + final JobPatchOptions jobPatchOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.patch(jobId, jobPatchParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = patchDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @param jobPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void patch(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions) { + patchWithServiceResponseAsync(jobId, jobPatchParameter, jobPatchOptions).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @param jobPatchOptions Additional parameters for the operation + * @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 patchAsync(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(patchWithServiceResponseAsync(jobId, jobPatchParameter, jobPatchOptions), serviceCallback); + } + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @param jobPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable patchAsync(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions) { + return patchWithServiceResponseAsync(jobId, jobPatchParameter, jobPatchOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified job. + * This replaces only the job properties specified in the request. For example, if the job has constraints, and a request does not specify the constraints element, then the job keeps the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobPatchParameter The parameters for the request. + * @param jobPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> patchWithServiceResponseAsync(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (jobPatchParameter == null) { + throw new IllegalArgumentException("Parameter jobPatchParameter 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(jobPatchParameter); + Validator.validate(jobPatchOptions); + Integer timeout = null; + if (jobPatchOptions != null) { + timeout = jobPatchOptions.timeout(); + } + UUID clientRequestId = null; + if (jobPatchOptions != null) { + clientRequestId = jobPatchOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobPatchOptions != null) { + returnClientRequestId = jobPatchOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobPatchOptions != null) { + ocpDate = jobPatchOptions.ocpDate(); + } + String ifMatch = null; + if (jobPatchOptions != null) { + ifMatch = jobPatchOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobPatchOptions != null) { + ifNoneMatch = jobPatchOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobPatchOptions != null) { + ifModifiedSince = jobPatchOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobPatchOptions != null) { + ifUnmodifiedSince = jobPatchOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.patch(jobId, jobPatchParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = patchDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders patchDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobPatchHeaders.class); + } + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobId, JobUpdateParameter jobUpdateParameter) { + updateWithServiceResponseAsync(jobId, jobUpdateParameter).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter 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 jobId, JobUpdateParameter jobUpdateParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(jobId, jobUpdateParameter), serviceCallback); + } + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable updateAsync(String jobId, JobUpdateParameter jobUpdateParameter) { + return updateWithServiceResponseAsync(jobId, jobUpdateParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String jobId, JobUpdateParameter jobUpdateParameter) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (jobUpdateParameter == null) { + throw new IllegalArgumentException("Parameter jobUpdateParameter 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(jobUpdateParameter); + final JobUpdateOptions jobUpdateOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.update(jobId, jobUpdateParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @param jobUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobId, JobUpdateParameter jobUpdateParameter, JobUpdateOptions jobUpdateOptions) { + updateWithServiceResponseAsync(jobId, jobUpdateParameter, jobUpdateOptions).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @param jobUpdateOptions Additional parameters for the operation + * @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 jobId, JobUpdateParameter jobUpdateParameter, JobUpdateOptions jobUpdateOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(jobId, jobUpdateParameter, jobUpdateOptions), serviceCallback); + } + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @param jobUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable updateAsync(String jobId, JobUpdateParameter jobUpdateParameter, JobUpdateOptions jobUpdateOptions) { + return updateWithServiceResponseAsync(jobId, jobUpdateParameter, jobUpdateOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified job. + * This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints. + * + * @param jobId The ID of the job whose properties you want to update. + * @param jobUpdateParameter The parameters for the request. + * @param jobUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String jobId, JobUpdateParameter jobUpdateParameter, JobUpdateOptions jobUpdateOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (jobUpdateParameter == null) { + throw new IllegalArgumentException("Parameter jobUpdateParameter 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(jobUpdateParameter); + Validator.validate(jobUpdateOptions); + Integer timeout = null; + if (jobUpdateOptions != null) { + timeout = jobUpdateOptions.timeout(); + } + UUID clientRequestId = null; + if (jobUpdateOptions != null) { + clientRequestId = jobUpdateOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobUpdateOptions != null) { + returnClientRequestId = jobUpdateOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobUpdateOptions != null) { + ocpDate = jobUpdateOptions.ocpDate(); + } + String ifMatch = null; + if (jobUpdateOptions != null) { + ifMatch = jobUpdateOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobUpdateOptions != null) { + ifNoneMatch = jobUpdateOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobUpdateOptions != null) { + ifModifiedSince = jobUpdateOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobUpdateOptions != null) { + ifUnmodifiedSince = jobUpdateOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.update(jobId, jobUpdateParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders updateDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobUpdateHeaders.class); + } + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void disable(String jobId, DisableJobOption disableTasks) { + disableWithServiceResponseAsync(jobId, disableTasks).toBlocking().single().body(); + } + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @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 disableAsync(String jobId, DisableJobOption disableTasks, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(disableWithServiceResponseAsync(jobId, disableTasks), serviceCallback); + } + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable disableAsync(String jobId, DisableJobOption disableTasks) { + return disableWithServiceResponseAsync(jobId, disableTasks).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> disableWithServiceResponseAsync(String jobId, DisableJobOption disableTasks) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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 (disableTasks == null) { + throw new IllegalArgumentException("Parameter disableTasks is required and cannot be null."); + } + final JobDisableOptions jobDisableOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + JobDisableParameter jobDisableParameter = new JobDisableParameter(); + jobDisableParameter.withDisableTasks(disableTasks); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.disable(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, jobDisableParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = disableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @param jobDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void disable(String jobId, DisableJobOption disableTasks, JobDisableOptions jobDisableOptions) { + disableWithServiceResponseAsync(jobId, disableTasks, jobDisableOptions).toBlocking().single().body(); + } + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @param jobDisableOptions Additional parameters for the operation + * @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 disableAsync(String jobId, DisableJobOption disableTasks, JobDisableOptions jobDisableOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(disableWithServiceResponseAsync(jobId, disableTasks, jobDisableOptions), serviceCallback); + } + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @param jobDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable disableAsync(String jobId, DisableJobOption disableTasks, JobDisableOptions jobDisableOptions) { + return disableWithServiceResponseAsync(jobId, disableTasks, jobDisableOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Disables the specified job, preventing new tasks from running. + * The Batch Service immediately moves the job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running tasks of the job. The job remains in the disabling state until the disable operation is completed and all tasks have been dealt with according to the disableTasks option; the job then moves to the disabled state. No new tasks are started under the job until it moves back to active state. If you try to disable a job that is in any state other than active, disabling, or disabled, the request fails with status code 409. + * + * @param jobId The ID of the job to disable. + * @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait' + * @param jobDisableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> disableWithServiceResponseAsync(String jobId, DisableJobOption disableTasks, JobDisableOptions jobDisableOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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 (disableTasks == null) { + throw new IllegalArgumentException("Parameter disableTasks is required and cannot be null."); + } + Validator.validate(jobDisableOptions); + Integer timeout = null; + if (jobDisableOptions != null) { + timeout = jobDisableOptions.timeout(); + } + UUID clientRequestId = null; + if (jobDisableOptions != null) { + clientRequestId = jobDisableOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobDisableOptions != null) { + returnClientRequestId = jobDisableOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobDisableOptions != null) { + ocpDate = jobDisableOptions.ocpDate(); + } + String ifMatch = null; + if (jobDisableOptions != null) { + ifMatch = jobDisableOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobDisableOptions != null) { + ifNoneMatch = jobDisableOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobDisableOptions != null) { + ifModifiedSince = jobDisableOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobDisableOptions != null) { + ifUnmodifiedSince = jobDisableOptions.ifUnmodifiedSince(); + } + JobDisableParameter jobDisableParameter = new JobDisableParameter(); + jobDisableParameter.withDisableTasks(disableTasks); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.disable(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, jobDisableParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = disableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders disableDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobDisableHeaders.class); + } + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enable(String jobId) { + enableWithServiceResponseAsync(jobId).toBlocking().single().body(); + } + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @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 enableAsync(String jobId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(enableWithServiceResponseAsync(jobId), serviceCallback); + } + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable enableAsync(String jobId) { + return enableWithServiceResponseAsync(jobId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> enableWithServiceResponseAsync(String jobId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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 JobEnableOptions jobEnableOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.enable(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = enableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @param jobEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enable(String jobId, JobEnableOptions jobEnableOptions) { + enableWithServiceResponseAsync(jobId, jobEnableOptions).toBlocking().single().body(); + } + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @param jobEnableOptions Additional parameters for the operation + * @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 enableAsync(String jobId, JobEnableOptions jobEnableOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(enableWithServiceResponseAsync(jobId, jobEnableOptions), serviceCallback); + } + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @param jobEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable enableAsync(String jobId, JobEnableOptions jobEnableOptions) { + return enableWithServiceResponseAsync(jobId, jobEnableOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Enables the specified job, allowing new tasks to run. + * When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. + * + * @param jobId The ID of the job to enable. + * @param jobEnableOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> enableWithServiceResponseAsync(String jobId, JobEnableOptions jobEnableOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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(jobEnableOptions); + Integer timeout = null; + if (jobEnableOptions != null) { + timeout = jobEnableOptions.timeout(); + } + UUID clientRequestId = null; + if (jobEnableOptions != null) { + clientRequestId = jobEnableOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobEnableOptions != null) { + returnClientRequestId = jobEnableOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobEnableOptions != null) { + ocpDate = jobEnableOptions.ocpDate(); + } + String ifMatch = null; + if (jobEnableOptions != null) { + ifMatch = jobEnableOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobEnableOptions != null) { + ifNoneMatch = jobEnableOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobEnableOptions != null) { + ifModifiedSince = jobEnableOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobEnableOptions != null) { + ifUnmodifiedSince = jobEnableOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.enable(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = enableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders enableDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobEnableHeaders.class); + } + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void terminate(String jobId) { + terminateWithServiceResponseAsync(jobId).toBlocking().single().body(); + } + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @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 terminateAsync(String jobId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(terminateWithServiceResponseAsync(jobId), serviceCallback); + } + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable terminateAsync(String jobId) { + return terminateWithServiceResponseAsync(jobId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> terminateWithServiceResponseAsync(String jobId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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 String terminateReason = null; + final JobTerminateOptions jobTerminateOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + JobTerminateParameter jobTerminateParameter = new JobTerminateParameter(); + jobTerminateParameter.withTerminateReason(null); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.terminate(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, jobTerminateParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = terminateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @param terminateReason The text you want to appear as the job's TerminateReason. The default is 'UserTerminate'. + * @param jobTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void terminate(String jobId, String terminateReason, JobTerminateOptions jobTerminateOptions) { + terminateWithServiceResponseAsync(jobId, terminateReason, jobTerminateOptions).toBlocking().single().body(); + } + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @param terminateReason The text you want to appear as the job's TerminateReason. The default is 'UserTerminate'. + * @param jobTerminateOptions Additional parameters for the operation + * @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 terminateAsync(String jobId, String terminateReason, JobTerminateOptions jobTerminateOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(terminateWithServiceResponseAsync(jobId, terminateReason, jobTerminateOptions), serviceCallback); + } + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @param terminateReason The text you want to appear as the job's TerminateReason. The default is 'UserTerminate'. + * @param jobTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable terminateAsync(String jobId, String terminateReason, JobTerminateOptions jobTerminateOptions) { + return terminateWithServiceResponseAsync(jobId, terminateReason, jobTerminateOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Terminates the specified job, marking it as completed. + * When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled. + * + * @param jobId The ID of the job to terminate. + * @param terminateReason The text you want to appear as the job's TerminateReason. The default is 'UserTerminate'. + * @param jobTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> terminateWithServiceResponseAsync(String jobId, String terminateReason, JobTerminateOptions jobTerminateOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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(jobTerminateOptions); + Integer timeout = null; + if (jobTerminateOptions != null) { + timeout = jobTerminateOptions.timeout(); + } + UUID clientRequestId = null; + if (jobTerminateOptions != null) { + clientRequestId = jobTerminateOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobTerminateOptions != null) { + returnClientRequestId = jobTerminateOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobTerminateOptions != null) { + ocpDate = jobTerminateOptions.ocpDate(); + } + String ifMatch = null; + if (jobTerminateOptions != null) { + ifMatch = jobTerminateOptions.ifMatch(); + } + String ifNoneMatch = null; + if (jobTerminateOptions != null) { + ifNoneMatch = jobTerminateOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (jobTerminateOptions != null) { + ifModifiedSince = jobTerminateOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (jobTerminateOptions != null) { + ifUnmodifiedSince = jobTerminateOptions.ifUnmodifiedSince(); + } + JobTerminateParameter jobTerminateParameter = null; + if (terminateReason != null) { + jobTerminateParameter = new JobTerminateParameter(); + jobTerminateParameter.withTerminateReason(terminateReason); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.terminate(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, jobTerminateParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = terminateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders terminateDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobTerminateHeaders.class); + } + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void add(JobAddParameter job) { + addWithServiceResponseAsync(job).toBlocking().single().body(); + } + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @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 addAsync(JobAddParameter job, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(job), serviceCallback); + } + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addAsync(JobAddParameter job) { + return addWithServiceResponseAsync(job).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addWithServiceResponseAsync(JobAddParameter job) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (job == null) { + throw new IllegalArgumentException("Parameter job 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(job); + final JobAddOptions jobAddOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.add(job, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @param jobAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void add(JobAddParameter job, JobAddOptions jobAddOptions) { + addWithServiceResponseAsync(job, jobAddOptions).toBlocking().single().body(); + } + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @param jobAddOptions Additional parameters for the operation + * @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 addAsync(JobAddParameter job, JobAddOptions jobAddOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(job, jobAddOptions), serviceCallback); + } + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @param jobAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addAsync(JobAddParameter job, JobAddOptions jobAddOptions) { + return addWithServiceResponseAsync(job, jobAddOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a job to the specified account. + * The Batch service supports two ways to control the work done as part of a job. In the first approach, the user specifies a Job Manager task. The Batch service launches this task when it is ready to start the job. The Job Manager task controls all other tasks that run under this job, by using the Task APIs. In the second approach, the user directly controls the execution of tasks under an active job, by using the Task APIs. Also note: when naming jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param job The job to be added. + * @param jobAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addWithServiceResponseAsync(JobAddParameter job, JobAddOptions jobAddOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (job == null) { + throw new IllegalArgumentException("Parameter job 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(job); + Validator.validate(jobAddOptions); + Integer timeout = null; + if (jobAddOptions != null) { + timeout = jobAddOptions.timeout(); + } + UUID clientRequestId = null; + if (jobAddOptions != null) { + clientRequestId = jobAddOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobAddOptions != null) { + returnClientRequestId = jobAddOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobAddOptions != null) { + ocpDate = jobAddOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.add(job, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders addDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobAddHeaders.class); + } + + /** + * Lists all of the jobs in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + public PagedList list() { + ServiceResponseWithHeaders, JobListHeaders> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the jobs in the specified 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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(), + new Func1, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the jobs in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1, JobListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the jobs in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable, JobListHeaders>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1, JobListHeaders>, Observable, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(ServiceResponseWithHeaders, JobListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the jobs in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudJob> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListHeaders>> listSinglePageAsync() { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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 JobListOptions jobListOptions = null; + String filter = null; + String select = null; + String expand = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the jobs in the specified account. + * + * @param jobListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + public PagedList list(final JobListOptions jobListOptions) { + ServiceResponseWithHeaders, JobListHeaders> response = listSinglePageAsync(jobListOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + JobListNextOptions jobListNextOptions = null; + if (jobListOptions != null) { + jobListNextOptions = new JobListNextOptions(); + jobListNextOptions.withClientRequestId(jobListOptions.clientRequestId()); + jobListNextOptions.withReturnClientRequestId(jobListOptions.returnClientRequestId()); + jobListNextOptions.withOcpDate(jobListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, jobListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the jobs in the specified account. + * + * @param jobListOptions Additional parameters for the operation + * @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 JobListOptions jobListOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(jobListOptions), + new Func1, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(String nextPageLink) { + JobListNextOptions jobListNextOptions = null; + if (jobListOptions != null) { + jobListNextOptions = new JobListNextOptions(); + jobListNextOptions.withClientRequestId(jobListOptions.clientRequestId()); + jobListNextOptions.withReturnClientRequestId(jobListOptions.returnClientRequestId()); + jobListNextOptions.withOcpDate(jobListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, jobListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the jobs in the specified account. + * + * @param jobListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable> listAsync(final JobListOptions jobListOptions) { + return listWithServiceResponseAsync(jobListOptions) + .map(new Func1, JobListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the jobs in the specified account. + * + * @param jobListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable, JobListHeaders>> listWithServiceResponseAsync(final JobListOptions jobListOptions) { + return listSinglePageAsync(jobListOptions) + .concatMap(new Func1, JobListHeaders>, Observable, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(ServiceResponseWithHeaders, JobListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + JobListNextOptions jobListNextOptions = null; + if (jobListOptions != null) { + jobListNextOptions = new JobListNextOptions(); + jobListNextOptions.withClientRequestId(jobListOptions.clientRequestId()); + jobListNextOptions.withReturnClientRequestId(jobListOptions.returnClientRequestId()); + jobListNextOptions.withOcpDate(jobListOptions.ocpDate()); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobListNextOptions)); + } + }); + } + + /** + * Lists all of the jobs in the specified account. + * + ServiceResponseWithHeaders, JobListHeaders> * @param jobListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudJob> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListHeaders>> listSinglePageAsync(final JobListOptions jobListOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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(jobListOptions); + String filter = null; + if (jobListOptions != null) { + filter = jobListOptions.filter(); + } + String select = null; + if (jobListOptions != null) { + select = jobListOptions.select(); + } + String expand = null; + if (jobListOptions != null) { + expand = jobListOptions.expand(); + } + Integer maxResults = null; + if (jobListOptions != null) { + maxResults = jobListOptions.maxResults(); + } + Integer timeout = null; + if (jobListOptions != null) { + timeout = jobListOptions.timeout(); + } + UUID clientRequestId = null; + if (jobListOptions != null) { + clientRequestId = jobListOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobListOptions != null) { + returnClientRequestId = jobListOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobListOptions != null) { + ocpDate = jobListOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, JobListHeaders> listDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobListHeaders.class); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + public PagedList listFromJobSchedule(final String jobScheduleId) { + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> response = listFromJobScheduleSinglePageAsync(jobScheduleId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listFromJobScheduleNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @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> listFromJobScheduleAsync(final String jobScheduleId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromJobScheduleSinglePageAsync(jobScheduleId), + new Func1, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(String nextPageLink) { + return listFromJobScheduleNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable> listFromJobScheduleAsync(final String jobScheduleId) { + return listFromJobScheduleWithServiceResponseAsync(jobScheduleId) + .map(new Func1, JobListFromJobScheduleHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleWithServiceResponseAsync(final String jobScheduleId) { + return listFromJobScheduleSinglePageAsync(jobScheduleId) + .concatMap(new Func1, JobListFromJobScheduleHeaders>, Observable, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listFromJobScheduleNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudJob> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleSinglePageAsync(final String jobScheduleId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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 JobListFromJobScheduleOptions jobListFromJobScheduleOptions = null; + String filter = null; + String select = null; + String expand = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listFromJobSchedule(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> result = listFromJobScheduleDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListFromJobScheduleHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @param jobListFromJobScheduleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + public PagedList listFromJobSchedule(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions) { + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> response = listFromJobScheduleSinglePageAsync(jobScheduleId, jobListFromJobScheduleOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions = null; + if (jobListFromJobScheduleOptions != null) { + jobListFromJobScheduleNextOptions = new JobListFromJobScheduleNextOptions(); + jobListFromJobScheduleNextOptions.withClientRequestId(jobListFromJobScheduleOptions.clientRequestId()); + jobListFromJobScheduleNextOptions.withReturnClientRequestId(jobListFromJobScheduleOptions.returnClientRequestId()); + jobListFromJobScheduleNextOptions.withOcpDate(jobListFromJobScheduleOptions.ocpDate()); + } + return listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @param jobListFromJobScheduleOptions Additional parameters for the operation + * @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> listFromJobScheduleAsync(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromJobScheduleSinglePageAsync(jobScheduleId, jobListFromJobScheduleOptions), + new Func1, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(String nextPageLink) { + JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions = null; + if (jobListFromJobScheduleOptions != null) { + jobListFromJobScheduleNextOptions = new JobListFromJobScheduleNextOptions(); + jobListFromJobScheduleNextOptions.withClientRequestId(jobListFromJobScheduleOptions.clientRequestId()); + jobListFromJobScheduleNextOptions.withReturnClientRequestId(jobListFromJobScheduleOptions.returnClientRequestId()); + jobListFromJobScheduleNextOptions.withOcpDate(jobListFromJobScheduleOptions.ocpDate()); + } + return listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @param jobListFromJobScheduleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable> listFromJobScheduleAsync(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions) { + return listFromJobScheduleWithServiceResponseAsync(jobScheduleId, jobListFromJobScheduleOptions) + .map(new Func1, JobListFromJobScheduleHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + * @param jobListFromJobScheduleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleWithServiceResponseAsync(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions) { + return listFromJobScheduleSinglePageAsync(jobScheduleId, jobListFromJobScheduleOptions) + .concatMap(new Func1, JobListFromJobScheduleHeaders>, Observable, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions = null; + if (jobListFromJobScheduleOptions != null) { + jobListFromJobScheduleNextOptions = new JobListFromJobScheduleNextOptions(); + jobListFromJobScheduleNextOptions.withClientRequestId(jobListFromJobScheduleOptions.clientRequestId()); + jobListFromJobScheduleNextOptions.withReturnClientRequestId(jobListFromJobScheduleOptions.returnClientRequestId()); + jobListFromJobScheduleNextOptions.withOcpDate(jobListFromJobScheduleOptions.ocpDate()); + } + return Observable.just(page).concatWith(listFromJobScheduleNextWithServiceResponseAsync(nextPageLink, jobListFromJobScheduleNextOptions)); + } + }); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> * @param jobScheduleId The ID of the job schedule from which you want to get a list of jobs. + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> * @param jobListFromJobScheduleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudJob> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleSinglePageAsync(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobScheduleId == null) { + throw new IllegalArgumentException("Parameter jobScheduleId 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(jobListFromJobScheduleOptions); + String filter = null; + if (jobListFromJobScheduleOptions != null) { + filter = jobListFromJobScheduleOptions.filter(); + } + String select = null; + if (jobListFromJobScheduleOptions != null) { + select = jobListFromJobScheduleOptions.select(); + } + String expand = null; + if (jobListFromJobScheduleOptions != null) { + expand = jobListFromJobScheduleOptions.expand(); + } + Integer maxResults = null; + if (jobListFromJobScheduleOptions != null) { + maxResults = jobListFromJobScheduleOptions.maxResults(); + } + Integer timeout = null; + if (jobListFromJobScheduleOptions != null) { + timeout = jobListFromJobScheduleOptions.timeout(); + } + UUID clientRequestId = null; + if (jobListFromJobScheduleOptions != null) { + clientRequestId = jobListFromJobScheduleOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobListFromJobScheduleOptions != null) { + returnClientRequestId = jobListFromJobScheduleOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobListFromJobScheduleOptions != null) { + ocpDate = jobListFromJobScheduleOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listFromJobSchedule(jobScheduleId, this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> result = listFromJobScheduleDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListFromJobScheduleHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> listFromJobScheduleDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobListFromJobScheduleHeaders.class); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<JobPreparationAndReleaseTaskExecutionInformation> object if successful. + */ + public PagedList listPreparationAndReleaseTaskStatus(final String jobId) { + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> response = listPreparationAndReleaseTaskStatusSinglePageAsync(jobId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @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> listPreparationAndReleaseTaskStatusAsync(final String jobId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listPreparationAndReleaseTaskStatusSinglePageAsync(jobId), + new Func1, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(String nextPageLink) { + return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + public Observable> listPreparationAndReleaseTaskStatusAsync(final String jobId) { + return listPreparationAndReleaseTaskStatusWithServiceResponseAsync(jobId) + .map(new Func1, JobListPreparationAndReleaseTaskStatusHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusWithServiceResponseAsync(final String jobId) { + return listPreparationAndReleaseTaskStatusSinglePageAsync(jobId) + .concatMap(new Func1, JobListPreparationAndReleaseTaskStatusHeaders>, Observable, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusSinglePageAsync(final String jobId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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 JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions = null; + String filter = null; + String select = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listPreparationAndReleaseTaskStatus(jobId, this.client.apiVersion(), this.client.acceptLanguage(), filter, select, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> result = listPreparationAndReleaseTaskStatusDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @param jobListPreparationAndReleaseTaskStatusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<JobPreparationAndReleaseTaskExecutionInformation> object if successful. + */ + public PagedList listPreparationAndReleaseTaskStatus(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions) { + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> response = listPreparationAndReleaseTaskStatusSinglePageAsync(jobId, jobListPreparationAndReleaseTaskStatusOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions = null; + if (jobListPreparationAndReleaseTaskStatusOptions != null) { + jobListPreparationAndReleaseTaskStatusNextOptions = new JobListPreparationAndReleaseTaskStatusNextOptions(); + jobListPreparationAndReleaseTaskStatusNextOptions.withClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.clientRequestId()); + jobListPreparationAndReleaseTaskStatusNextOptions.withReturnClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.returnClientRequestId()); + jobListPreparationAndReleaseTaskStatusNextOptions.withOcpDate(jobListPreparationAndReleaseTaskStatusOptions.ocpDate()); + } + return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @param jobListPreparationAndReleaseTaskStatusOptions Additional parameters for the operation + * @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> listPreparationAndReleaseTaskStatusAsync(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listPreparationAndReleaseTaskStatusSinglePageAsync(jobId, jobListPreparationAndReleaseTaskStatusOptions), + new Func1, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(String nextPageLink) { + JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions = null; + if (jobListPreparationAndReleaseTaskStatusOptions != null) { + jobListPreparationAndReleaseTaskStatusNextOptions = new JobListPreparationAndReleaseTaskStatusNextOptions(); + jobListPreparationAndReleaseTaskStatusNextOptions.withClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.clientRequestId()); + jobListPreparationAndReleaseTaskStatusNextOptions.withReturnClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.returnClientRequestId()); + jobListPreparationAndReleaseTaskStatusNextOptions.withOcpDate(jobListPreparationAndReleaseTaskStatusOptions.ocpDate()); + } + return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @param jobListPreparationAndReleaseTaskStatusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + public Observable> listPreparationAndReleaseTaskStatusAsync(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions) { + return listPreparationAndReleaseTaskStatusWithServiceResponseAsync(jobId, jobListPreparationAndReleaseTaskStatusOptions) + .map(new Func1, JobListPreparationAndReleaseTaskStatusHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param jobId The ID of the job. + * @param jobListPreparationAndReleaseTaskStatusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusWithServiceResponseAsync(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions) { + return listPreparationAndReleaseTaskStatusSinglePageAsync(jobId, jobListPreparationAndReleaseTaskStatusOptions) + .concatMap(new Func1, JobListPreparationAndReleaseTaskStatusHeaders>, Observable, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions = null; + if (jobListPreparationAndReleaseTaskStatusOptions != null) { + jobListPreparationAndReleaseTaskStatusNextOptions = new JobListPreparationAndReleaseTaskStatusNextOptions(); + jobListPreparationAndReleaseTaskStatusNextOptions.withClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.clientRequestId()); + jobListPreparationAndReleaseTaskStatusNextOptions.withReturnClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.returnClientRequestId()); + jobListPreparationAndReleaseTaskStatusNextOptions.withOcpDate(jobListPreparationAndReleaseTaskStatusOptions.ocpDate()); + } + return Observable.just(page).concatWith(listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions)); + } + }); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> * @param jobId The ID of the job. + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> * @param jobListPreparationAndReleaseTaskStatusOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusSinglePageAsync(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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(jobListPreparationAndReleaseTaskStatusOptions); + String filter = null; + if (jobListPreparationAndReleaseTaskStatusOptions != null) { + filter = jobListPreparationAndReleaseTaskStatusOptions.filter(); + } + String select = null; + if (jobListPreparationAndReleaseTaskStatusOptions != null) { + select = jobListPreparationAndReleaseTaskStatusOptions.select(); + } + Integer maxResults = null; + if (jobListPreparationAndReleaseTaskStatusOptions != null) { + maxResults = jobListPreparationAndReleaseTaskStatusOptions.maxResults(); + } + Integer timeout = null; + if (jobListPreparationAndReleaseTaskStatusOptions != null) { + timeout = jobListPreparationAndReleaseTaskStatusOptions.timeout(); + } + UUID clientRequestId = null; + if (jobListPreparationAndReleaseTaskStatusOptions != null) { + clientRequestId = jobListPreparationAndReleaseTaskStatusOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobListPreparationAndReleaseTaskStatusOptions != null) { + returnClientRequestId = jobListPreparationAndReleaseTaskStatusOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobListPreparationAndReleaseTaskStatusOptions != null) { + ocpDate = jobListPreparationAndReleaseTaskStatusOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listPreparationAndReleaseTaskStatus(jobId, this.client.apiVersion(), this.client.acceptLanguage(), filter, select, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> result = listPreparationAndReleaseTaskStatusDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> listPreparationAndReleaseTaskStatusDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobListPreparationAndReleaseTaskStatusHeaders.class); + } + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TaskCounts object if successful. + */ + public TaskCounts getTaskCounts(String jobId) { + return getTaskCountsWithServiceResponseAsync(jobId).toBlocking().single().body(); + } + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @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 getTaskCountsAsync(String jobId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getTaskCountsWithServiceResponseAsync(jobId), serviceCallback); + } + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskCounts object + */ + public Observable getTaskCountsAsync(String jobId) { + return getTaskCountsWithServiceResponseAsync(jobId).map(new Func1, TaskCounts>() { + @Override + public TaskCounts call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskCounts object + */ + public Observable> getTaskCountsWithServiceResponseAsync(String jobId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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 JobGetTaskCountsOptions jobGetTaskCountsOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.getTaskCounts(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getTaskCountsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @param jobGetTaskCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TaskCounts object if successful. + */ + public TaskCounts getTaskCounts(String jobId, JobGetTaskCountsOptions jobGetTaskCountsOptions) { + return getTaskCountsWithServiceResponseAsync(jobId, jobGetTaskCountsOptions).toBlocking().single().body(); + } + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @param jobGetTaskCountsOptions Additional parameters for the operation + * @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 getTaskCountsAsync(String jobId, JobGetTaskCountsOptions jobGetTaskCountsOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getTaskCountsWithServiceResponseAsync(jobId, jobGetTaskCountsOptions), serviceCallback); + } + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @param jobGetTaskCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskCounts object + */ + public Observable getTaskCountsAsync(String jobId, JobGetTaskCountsOptions jobGetTaskCountsOptions) { + return getTaskCountsWithServiceResponseAsync(jobId, jobGetTaskCountsOptions).map(new Func1, TaskCounts>() { + @Override + public TaskCounts call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the task counts for the specified job. + * Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. + * + * @param jobId The ID of the job. + * @param jobGetTaskCountsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskCounts object + */ + public Observable> getTaskCountsWithServiceResponseAsync(String jobId, JobGetTaskCountsOptions jobGetTaskCountsOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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(jobGetTaskCountsOptions); + Integer timeout = null; + if (jobGetTaskCountsOptions != null) { + timeout = jobGetTaskCountsOptions.timeout(); + } + UUID clientRequestId = null; + if (jobGetTaskCountsOptions != null) { + clientRequestId = jobGetTaskCountsOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobGetTaskCountsOptions != null) { + returnClientRequestId = jobGetTaskCountsOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobGetTaskCountsOptions != null) { + ocpDate = jobGetTaskCountsOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.getTaskCounts(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getTaskCountsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getTaskCountsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobGetTaskCountsHeaders.class); + } + + /** + * Lists all of the jobs 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 BatchErrorException 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<CloudJob> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponseWithHeaders, JobListHeaders> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the jobs 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.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the jobs 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<CloudJob> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, JobListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the jobs 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<CloudJob> object + */ + public Observable, JobListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, JobListHeaders>, Observable, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(ServiceResponseWithHeaders, JobListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the jobs 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 PagedList<CloudJob> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListHeaders>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final JobListNextOptions jobListNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the jobs in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + public PagedList listNext(final String nextPageLink, final JobListNextOptions jobListNextOptions) { + ServiceResponseWithHeaders, JobListHeaders> response = listNextSinglePageAsync(nextPageLink, jobListNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, jobListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the jobs in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListNextOptions Additional parameters for the 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 JobListNextOptions jobListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink, jobListNextOptions), + new Func1, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, jobListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the jobs in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable> listNextAsync(final String nextPageLink, final JobListNextOptions jobListNextOptions) { + return listNextWithServiceResponseAsync(nextPageLink, jobListNextOptions) + .map(new Func1, JobListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the jobs in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable, JobListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final JobListNextOptions jobListNextOptions) { + return listNextSinglePageAsync(nextPageLink, jobListNextOptions) + .concatMap(new Func1, JobListHeaders>, Observable, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(ServiceResponseWithHeaders, JobListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobListNextOptions)); + } + }); + } + + /** + * Lists all of the jobs in the specified account. + * + ServiceResponseWithHeaders, JobListHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, JobListHeaders> * @param jobListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudJob> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListHeaders>> listNextSinglePageAsync(final String nextPageLink, final JobListNextOptions jobListNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(jobListNextOptions); + UUID clientRequestId = null; + if (jobListNextOptions != null) { + clientRequestId = jobListNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobListNextOptions != null) { + returnClientRequestId = jobListNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobListNextOptions != null) { + ocpDate = jobListNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListHeaders>>>() { + @Override + public Observable, JobListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, JobListHeaders> listNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobListHeaders.class); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + public PagedList listFromJobScheduleNext(final String nextPageLink) { + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> response = listFromJobScheduleNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listFromJobScheduleNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @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> listFromJobScheduleNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromJobScheduleNextSinglePageAsync(nextPageLink), + new Func1, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(String nextPageLink) { + return listFromJobScheduleNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @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<CloudJob> object + */ + public Observable> listFromJobScheduleNextAsync(final String nextPageLink) { + return listFromJobScheduleNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, JobListFromJobScheduleHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @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<CloudJob> object + */ + public Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleNextWithServiceResponseAsync(final String nextPageLink) { + return listFromJobScheduleNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, JobListFromJobScheduleHeaders>, Observable, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listFromJobScheduleNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudJob> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listFromJobScheduleNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> result = listFromJobScheduleNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListFromJobScheduleHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListFromJobScheduleNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudJob> object if successful. + */ + public PagedList listFromJobScheduleNext(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions) { + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> response = listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListFromJobScheduleNextOptions Additional parameters for the 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> listFromJobScheduleNextAsync(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions), + new Func1, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(String nextPageLink) { + return listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListFromJobScheduleNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable> listFromJobScheduleNextAsync(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions) { + return listFromJobScheduleNextWithServiceResponseAsync(nextPageLink, jobListFromJobScheduleNextOptions) + .map(new Func1, JobListFromJobScheduleHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListFromJobScheduleNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudJob> object + */ + public Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleNextWithServiceResponseAsync(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions) { + return listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions) + .concatMap(new Func1, JobListFromJobScheduleHeaders>, Observable, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listFromJobScheduleNextWithServiceResponseAsync(nextPageLink, jobListFromJobScheduleNextOptions)); + } + }); + } + + /** + * Lists the jobs that have been created under the specified job schedule. + * + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> * @param jobListFromJobScheduleNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudJob> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListFromJobScheduleHeaders>> listFromJobScheduleNextSinglePageAsync(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(jobListFromJobScheduleNextOptions); + UUID clientRequestId = null; + if (jobListFromJobScheduleNextOptions != null) { + clientRequestId = jobListFromJobScheduleNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobListFromJobScheduleNextOptions != null) { + returnClientRequestId = jobListFromJobScheduleNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobListFromJobScheduleNextOptions != null) { + ocpDate = jobListFromJobScheduleNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listFromJobScheduleNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListFromJobScheduleHeaders>>>() { + @Override + public Observable, JobListFromJobScheduleHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> result = listFromJobScheduleNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListFromJobScheduleHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, JobListFromJobScheduleHeaders> listFromJobScheduleNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobListFromJobScheduleHeaders.class); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<JobPreparationAndReleaseTaskExecutionInformation> object if successful. + */ + public PagedList listPreparationAndReleaseTaskStatusNext(final String nextPageLink) { + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> response = listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @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> listPreparationAndReleaseTaskStatusNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink), + new Func1, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(String nextPageLink) { + return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @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<JobPreparationAndReleaseTaskExecutionInformation> object + */ + public Observable> listPreparationAndReleaseTaskStatusNextAsync(final String nextPageLink) { + return listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, JobListPreparationAndReleaseTaskStatusHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @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<JobPreparationAndReleaseTaskExecutionInformation> object + */ + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(final String nextPageLink) { + return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, JobListPreparationAndReleaseTaskStatusHeaders>, Observable, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listPreparationAndReleaseTaskStatusNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> result = listPreparationAndReleaseTaskStatusNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<JobPreparationAndReleaseTaskExecutionInformation> object if successful. + */ + public PagedList listPreparationAndReleaseTaskStatusNext(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions) { + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> response = listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the 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> listPreparationAndReleaseTaskStatusNextAsync(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions), + new Func1, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(String nextPageLink) { + return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + public Observable> listPreparationAndReleaseTaskStatusNextAsync(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions) { + return listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions) + .map(new Func1, JobListPreparationAndReleaseTaskStatusHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object + */ + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions) { + return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions) + .concatMap(new Func1, JobListPreparationAndReleaseTaskStatusHeaders>, Observable, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions)); + } + }); + } + + /** + * Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. + * This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. + * + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> * @param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusNextSinglePageAsync(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(jobListPreparationAndReleaseTaskStatusNextOptions); + UUID clientRequestId = null; + if (jobListPreparationAndReleaseTaskStatusNextOptions != null) { + clientRequestId = jobListPreparationAndReleaseTaskStatusNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (jobListPreparationAndReleaseTaskStatusNextOptions != null) { + returnClientRequestId = jobListPreparationAndReleaseTaskStatusNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (jobListPreparationAndReleaseTaskStatusNextOptions != null) { + ocpDate = jobListPreparationAndReleaseTaskStatusNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listPreparationAndReleaseTaskStatusNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, JobListPreparationAndReleaseTaskStatusHeaders>>>() { + @Override + public Observable, JobListPreparationAndReleaseTaskStatusHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> result = listPreparationAndReleaseTaskStatusNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, JobListPreparationAndReleaseTaskStatusHeaders> listPreparationAndReleaseTaskStatusNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, JobListPreparationAndReleaseTaskStatusHeaders.class); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java new file mode 100644 index 000000000000..5ce34caa42da --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java @@ -0,0 +1,4139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.batch.protocol.Pools; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.batch.protocol.models.AutoScaleRun; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.CloudPool; +import com.microsoft.azure.batch.protocol.models.NodeRemoveParameter; +import com.microsoft.azure.batch.protocol.models.PageImpl; +import com.microsoft.azure.batch.protocol.models.PoolAddHeaders; +import com.microsoft.azure.batch.protocol.models.PoolAddOptions; +import com.microsoft.azure.batch.protocol.models.PoolAddParameter; +import com.microsoft.azure.batch.protocol.models.PoolDeleteHeaders; +import com.microsoft.azure.batch.protocol.models.PoolDeleteOptions; +import com.microsoft.azure.batch.protocol.models.PoolDisableAutoScaleHeaders; +import com.microsoft.azure.batch.protocol.models.PoolDisableAutoScaleOptions; +import com.microsoft.azure.batch.protocol.models.PoolEnableAutoScaleHeaders; +import com.microsoft.azure.batch.protocol.models.PoolEnableAutoScaleOptions; +import com.microsoft.azure.batch.protocol.models.PoolEnableAutoScaleParameter; +import com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleHeaders; +import com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleOptions; +import com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleParameter; +import com.microsoft.azure.batch.protocol.models.PoolExistsHeaders; +import com.microsoft.azure.batch.protocol.models.PoolExistsOptions; +import com.microsoft.azure.batch.protocol.models.PoolGetAllLifetimeStatisticsHeaders; +import com.microsoft.azure.batch.protocol.models.PoolGetAllLifetimeStatisticsOptions; +import com.microsoft.azure.batch.protocol.models.PoolGetHeaders; +import com.microsoft.azure.batch.protocol.models.PoolGetOptions; +import com.microsoft.azure.batch.protocol.models.PoolListHeaders; +import com.microsoft.azure.batch.protocol.models.PoolListNextOptions; +import com.microsoft.azure.batch.protocol.models.PoolListOptions; +import com.microsoft.azure.batch.protocol.models.PoolListUsageMetricsHeaders; +import com.microsoft.azure.batch.protocol.models.PoolListUsageMetricsNextOptions; +import com.microsoft.azure.batch.protocol.models.PoolListUsageMetricsOptions; +import com.microsoft.azure.batch.protocol.models.PoolPatchHeaders; +import com.microsoft.azure.batch.protocol.models.PoolPatchOptions; +import com.microsoft.azure.batch.protocol.models.PoolPatchParameter; +import com.microsoft.azure.batch.protocol.models.PoolRemoveNodesHeaders; +import com.microsoft.azure.batch.protocol.models.PoolRemoveNodesOptions; +import com.microsoft.azure.batch.protocol.models.PoolResizeHeaders; +import com.microsoft.azure.batch.protocol.models.PoolResizeOptions; +import com.microsoft.azure.batch.protocol.models.PoolResizeParameter; +import com.microsoft.azure.batch.protocol.models.PoolStatistics; +import com.microsoft.azure.batch.protocol.models.PoolStopResizeHeaders; +import com.microsoft.azure.batch.protocol.models.PoolStopResizeOptions; +import com.microsoft.azure.batch.protocol.models.PoolUpdatePropertiesHeaders; +import com.microsoft.azure.batch.protocol.models.PoolUpdatePropertiesOptions; +import com.microsoft.azure.batch.protocol.models.PoolUpdatePropertiesParameter; +import com.microsoft.azure.batch.protocol.models.PoolUsageMetrics; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.DateTimeRfc1123; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +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.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 Pools. + */ +public class PoolsImpl implements Pools { + /** The Retrofit service to perform REST calls. */ + private PoolsService service; + /** The service client containing this operation class. */ + private BatchServiceClientImpl client; + + /** + * Initializes an instance of PoolsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PoolsImpl(Retrofit retrofit, BatchServiceClientImpl client) { + this.service = retrofit.create(PoolsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Pools to be + * used by Retrofit to perform actually REST calls. + */ + interface PoolsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools listUsageMetrics" }) + @GET("poolusagemetrics") + Observable> listUsageMetrics(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("starttime") DateTime startTime, @Query("endtime") DateTime endTime, @Query("$filter") String filter, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools getAllLifetimeStatistics" }) + @GET("lifetimepoolstats") + Observable> getAllLifetimeStatistics(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools add" }) + @POST("pools") + Observable> add(@Body PoolAddParameter pool, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools list" }) + @GET("pools") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("$select") String select, @Query("$expand") String expand, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools delete" }) + @HTTP(path = "pools/{poolId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools exists" }) + @HEAD("pools/{poolId}") + Observable> exists(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools get" }) + @GET("pools/{poolId}") + Observable> get(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$select") String select, @Query("$expand") String expand, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools patch" }) + @PATCH("pools/{poolId}") + Observable> patch(@Path("poolId") String poolId, @Body PoolPatchParameter poolPatchParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools disableAutoScale" }) + @POST("pools/{poolId}/disableautoscale") + Observable> disableAutoScale(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools enableAutoScale" }) + @POST("pools/{poolId}/enableautoscale") + Observable> enableAutoScale(@Path("poolId") String poolId, @Body PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools evaluateAutoScale" }) + @POST("pools/{poolId}/evaluateautoscale") + Observable> evaluateAutoScale(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Body PoolEvaluateAutoScaleParameter poolEvaluateAutoScaleParameter, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools resize" }) + @POST("pools/{poolId}/resize") + Observable> resize(@Path("poolId") String poolId, @Body PoolResizeParameter poolResizeParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools stopResize" }) + @POST("pools/{poolId}/stopresize") + Observable> stopResize(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools updateProperties" }) + @POST("pools/{poolId}/updateproperties") + Observable> updateProperties(@Path("poolId") String poolId, @Body PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools removeNodes" }) + @POST("pools/{poolId}/removenodes") + Observable> removeNodes(@Path("poolId") String poolId, @Body NodeRemoveParameter nodeRemoveParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools listUsageMetricsNext" }) + @GET + Observable> listUsageMetricsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolUsageMetrics> object if successful. + */ + public PagedList listUsageMetrics() { + ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response = listUsageMetricsSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listUsageMetricsNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @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> listUsageMetricsAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listUsageMetricsSinglePageAsync(), + new Func1, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(String nextPageLink) { + return listUsageMetricsNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + public Observable> listUsageMetricsAsync() { + return listUsageMetricsWithServiceResponseAsync() + .map(new Func1, PoolListUsageMetricsHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsWithServiceResponseAsync() { + return listUsageMetricsSinglePageAsync() + .concatMap(new Func1, PoolListUsageMetricsHeaders>, Observable, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listUsageMetricsNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PoolUsageMetrics> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsSinglePageAsync() { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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 PoolListUsageMetricsOptions poolListUsageMetricsOptions = null; + DateTime startTime = null; + DateTime endTime = null; + String filter = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listUsageMetrics(this.client.apiVersion(), this.client.acceptLanguage(), startTime, endTime, filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> result = listUsageMetricsDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, PoolListUsageMetricsHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param poolListUsageMetricsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolUsageMetrics> object if successful. + */ + public PagedList listUsageMetrics(final PoolListUsageMetricsOptions poolListUsageMetricsOptions) { + ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response = listUsageMetricsSinglePageAsync(poolListUsageMetricsOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null; + if (poolListUsageMetricsOptions != null) { + poolListUsageMetricsNextOptions = new PoolListUsageMetricsNextOptions(); + poolListUsageMetricsNextOptions.withClientRequestId(poolListUsageMetricsOptions.clientRequestId()); + poolListUsageMetricsNextOptions.withReturnClientRequestId(poolListUsageMetricsOptions.returnClientRequestId()); + poolListUsageMetricsNextOptions.withOcpDate(poolListUsageMetricsOptions.ocpDate()); + } + return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param poolListUsageMetricsOptions Additional parameters for the operation + * @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> listUsageMetricsAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listUsageMetricsSinglePageAsync(poolListUsageMetricsOptions), + new Func1, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(String nextPageLink) { + PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null; + if (poolListUsageMetricsOptions != null) { + poolListUsageMetricsNextOptions = new PoolListUsageMetricsNextOptions(); + poolListUsageMetricsNextOptions.withClientRequestId(poolListUsageMetricsOptions.clientRequestId()); + poolListUsageMetricsNextOptions.withReturnClientRequestId(poolListUsageMetricsOptions.returnClientRequestId()); + poolListUsageMetricsNextOptions.withOcpDate(poolListUsageMetricsOptions.ocpDate()); + } + return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param poolListUsageMetricsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + public Observable> listUsageMetricsAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions) { + return listUsageMetricsWithServiceResponseAsync(poolListUsageMetricsOptions) + .map(new Func1, PoolListUsageMetricsHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param poolListUsageMetricsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsWithServiceResponseAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions) { + return listUsageMetricsSinglePageAsync(poolListUsageMetricsOptions) + .concatMap(new Func1, PoolListUsageMetricsHeaders>, Observable, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null; + if (poolListUsageMetricsOptions != null) { + poolListUsageMetricsNextOptions = new PoolListUsageMetricsNextOptions(); + poolListUsageMetricsNextOptions.withClientRequestId(poolListUsageMetricsOptions.clientRequestId()); + poolListUsageMetricsNextOptions.withReturnClientRequestId(poolListUsageMetricsOptions.returnClientRequestId()); + poolListUsageMetricsNextOptions.withOcpDate(poolListUsageMetricsOptions.ocpDate()); + } + return Observable.just(page).concatWith(listUsageMetricsNextWithServiceResponseAsync(nextPageLink, poolListUsageMetricsNextOptions)); + } + }); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> * @param poolListUsageMetricsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PoolUsageMetrics> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsSinglePageAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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(poolListUsageMetricsOptions); + DateTime startTime = null; + if (poolListUsageMetricsOptions != null) { + startTime = poolListUsageMetricsOptions.startTime(); + } + DateTime endTime = null; + if (poolListUsageMetricsOptions != null) { + endTime = poolListUsageMetricsOptions.endTime(); + } + String filter = null; + if (poolListUsageMetricsOptions != null) { + filter = poolListUsageMetricsOptions.filter(); + } + Integer maxResults = null; + if (poolListUsageMetricsOptions != null) { + maxResults = poolListUsageMetricsOptions.maxResults(); + } + Integer timeout = null; + if (poolListUsageMetricsOptions != null) { + timeout = poolListUsageMetricsOptions.timeout(); + } + UUID clientRequestId = null; + if (poolListUsageMetricsOptions != null) { + clientRequestId = poolListUsageMetricsOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolListUsageMetricsOptions != null) { + returnClientRequestId = poolListUsageMetricsOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolListUsageMetricsOptions != null) { + ocpDate = poolListUsageMetricsOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listUsageMetrics(this.client.apiVersion(), this.client.acceptLanguage(), startTime, endTime, filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> result = listUsageMetricsDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, PoolListUsageMetricsHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> listUsageMetricsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolListUsageMetricsHeaders.class); + } + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PoolStatistics object if successful. + */ + public PoolStatistics getAllLifetimeStatistics() { + return getAllLifetimeStatisticsWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @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 getAllLifetimeStatisticsAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getAllLifetimeStatisticsWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PoolStatistics object + */ + public Observable getAllLifetimeStatisticsAsync() { + return getAllLifetimeStatisticsWithServiceResponseAsync().map(new Func1, PoolStatistics>() { + @Override + public PoolStatistics call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PoolStatistics object + */ + public Observable> getAllLifetimeStatisticsWithServiceResponseAsync() { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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 PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.getAllLifetimeStatistics(this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getAllLifetimeStatisticsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PoolStatistics object if successful. + */ + public PoolStatistics getAllLifetimeStatistics(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions) { + return getAllLifetimeStatisticsWithServiceResponseAsync(poolGetAllLifetimeStatisticsOptions).toBlocking().single().body(); + } + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @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 getAllLifetimeStatisticsAsync(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getAllLifetimeStatisticsWithServiceResponseAsync(poolGetAllLifetimeStatisticsOptions), serviceCallback); + } + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PoolStatistics object + */ + public Observable getAllLifetimeStatisticsAsync(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions) { + return getAllLifetimeStatisticsWithServiceResponseAsync(poolGetAllLifetimeStatisticsOptions).map(new Func1, PoolStatistics>() { + @Override + public PoolStatistics call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets lifetime summary statistics for all of the pools in the specified account. + * Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + * + * @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PoolStatistics object + */ + public Observable> getAllLifetimeStatisticsWithServiceResponseAsync(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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(poolGetAllLifetimeStatisticsOptions); + Integer timeout = null; + if (poolGetAllLifetimeStatisticsOptions != null) { + timeout = poolGetAllLifetimeStatisticsOptions.timeout(); + } + UUID clientRequestId = null; + if (poolGetAllLifetimeStatisticsOptions != null) { + clientRequestId = poolGetAllLifetimeStatisticsOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolGetAllLifetimeStatisticsOptions != null) { + returnClientRequestId = poolGetAllLifetimeStatisticsOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolGetAllLifetimeStatisticsOptions != null) { + ocpDate = poolGetAllLifetimeStatisticsOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.getAllLifetimeStatistics(this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getAllLifetimeStatisticsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getAllLifetimeStatisticsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolGetAllLifetimeStatisticsHeaders.class); + } + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void add(PoolAddParameter pool) { + addWithServiceResponseAsync(pool).toBlocking().single().body(); + } + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @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 addAsync(PoolAddParameter pool, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(pool), serviceCallback); + } + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addAsync(PoolAddParameter pool) { + return addWithServiceResponseAsync(pool).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addWithServiceResponseAsync(PoolAddParameter pool) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (pool == null) { + throw new IllegalArgumentException("Parameter pool 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(pool); + final PoolAddOptions poolAddOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.add(pool, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @param poolAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void add(PoolAddParameter pool, PoolAddOptions poolAddOptions) { + addWithServiceResponseAsync(pool, poolAddOptions).toBlocking().single().body(); + } + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @param poolAddOptions Additional parameters for the operation + * @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 addAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(pool, poolAddOptions), serviceCallback); + } + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @param poolAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions) { + return addWithServiceResponseAsync(pool, poolAddOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a pool to the specified account. + * When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. + * + * @param pool The pool to be added. + * @param poolAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addWithServiceResponseAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (pool == null) { + throw new IllegalArgumentException("Parameter pool 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(pool); + Validator.validate(poolAddOptions); + Integer timeout = null; + if (poolAddOptions != null) { + timeout = poolAddOptions.timeout(); + } + UUID clientRequestId = null; + if (poolAddOptions != null) { + clientRequestId = poolAddOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolAddOptions != null) { + returnClientRequestId = poolAddOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolAddOptions != null) { + ocpDate = poolAddOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.add(pool, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders addDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolAddHeaders.class); + } + + /** + * Lists all of the pools in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudPool> object if successful. + */ + public PagedList list() { + ServiceResponseWithHeaders, PoolListHeaders> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the pools in the specified 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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(), + new Func1, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the pools in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1, PoolListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, PoolListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the pools in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + public Observable, PoolListHeaders>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1, PoolListHeaders>, Observable, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(ServiceResponseWithHeaders, PoolListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the pools in the specified account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudPool> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, PoolListHeaders>> listSinglePageAsync() { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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 PoolListOptions poolListOptions = null; + String filter = null; + String select = null; + String expand = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, PoolListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, PoolListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the pools in the specified account. + * + * @param poolListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudPool> object if successful. + */ + public PagedList list(final PoolListOptions poolListOptions) { + ServiceResponseWithHeaders, PoolListHeaders> response = listSinglePageAsync(poolListOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + PoolListNextOptions poolListNextOptions = null; + if (poolListOptions != null) { + poolListNextOptions = new PoolListNextOptions(); + poolListNextOptions.withClientRequestId(poolListOptions.clientRequestId()); + poolListNextOptions.withReturnClientRequestId(poolListOptions.returnClientRequestId()); + poolListNextOptions.withOcpDate(poolListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, poolListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the pools in the specified account. + * + * @param poolListOptions Additional parameters for the operation + * @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 PoolListOptions poolListOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(poolListOptions), + new Func1, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(String nextPageLink) { + PoolListNextOptions poolListNextOptions = null; + if (poolListOptions != null) { + poolListNextOptions = new PoolListNextOptions(); + poolListNextOptions.withClientRequestId(poolListOptions.clientRequestId()); + poolListNextOptions.withReturnClientRequestId(poolListOptions.returnClientRequestId()); + poolListNextOptions.withOcpDate(poolListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, poolListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the pools in the specified account. + * + * @param poolListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + public Observable> listAsync(final PoolListOptions poolListOptions) { + return listWithServiceResponseAsync(poolListOptions) + .map(new Func1, PoolListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, PoolListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the pools in the specified account. + * + * @param poolListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + public Observable, PoolListHeaders>> listWithServiceResponseAsync(final PoolListOptions poolListOptions) { + return listSinglePageAsync(poolListOptions) + .concatMap(new Func1, PoolListHeaders>, Observable, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(ServiceResponseWithHeaders, PoolListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + PoolListNextOptions poolListNextOptions = null; + if (poolListOptions != null) { + poolListNextOptions = new PoolListNextOptions(); + poolListNextOptions.withClientRequestId(poolListOptions.clientRequestId()); + poolListNextOptions.withReturnClientRequestId(poolListOptions.returnClientRequestId()); + poolListNextOptions.withOcpDate(poolListOptions.ocpDate()); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, poolListNextOptions)); + } + }); + } + + /** + * Lists all of the pools in the specified account. + * + ServiceResponseWithHeaders, PoolListHeaders> * @param poolListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudPool> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, PoolListHeaders>> listSinglePageAsync(final PoolListOptions poolListOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() 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(poolListOptions); + String filter = null; + if (poolListOptions != null) { + filter = poolListOptions.filter(); + } + String select = null; + if (poolListOptions != null) { + select = poolListOptions.select(); + } + String expand = null; + if (poolListOptions != null) { + expand = poolListOptions.expand(); + } + Integer maxResults = null; + if (poolListOptions != null) { + maxResults = poolListOptions.maxResults(); + } + Integer timeout = null; + if (poolListOptions != null) { + timeout = poolListOptions.timeout(); + } + UUID clientRequestId = null; + if (poolListOptions != null) { + clientRequestId = poolListOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolListOptions != null) { + returnClientRequestId = poolListOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolListOptions != null) { + ocpDate = poolListOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, PoolListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, PoolListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, PoolListHeaders> listDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolListHeaders.class); + } + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 poolId) { + deleteWithServiceResponseAsync(poolId).toBlocking().single().body(); + } + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool 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 poolId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(poolId), serviceCallback); + } + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteAsync(String poolId) { + return deleteWithServiceResponseAsync(poolId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String poolId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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 PoolDeleteOptions poolDeleteOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.delete(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @param poolDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 poolId, PoolDeleteOptions poolDeleteOptions) { + deleteWithServiceResponseAsync(poolId, poolDeleteOptions).toBlocking().single().body(); + } + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @param poolDeleteOptions Additional parameters for the operation + * @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 poolId, PoolDeleteOptions poolDeleteOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(poolId, poolDeleteOptions), serviceCallback); + } + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @param poolDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteAsync(String poolId, PoolDeleteOptions poolDeleteOptions) { + return deleteWithServiceResponseAsync(poolId, poolDeleteOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a pool from the specified account. + * When you request that a pool be deleted, the following actions occur: the pool state is set to deleting; any ongoing resize operation on the pool are stopped; the Batch service starts resizing the pool to zero nodes; any tasks running on existing nodes are terminated and requeued (as if a resize pool operation had been requested with the default requeue option); finally, the pool is removed from the system. Because running tasks are requeued, the user can rerun these tasks by updating their job to target a different pool. The tasks can then run on the new pool. If you want to override the requeue behavior, then you should call resize pool explicitly to shrink the pool to zero size before deleting the pool. If you call an Update, Patch or Delete API on a pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. + * + * @param poolId The ID of the pool to delete. + * @param poolDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String poolId, PoolDeleteOptions poolDeleteOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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(poolDeleteOptions); + Integer timeout = null; + if (poolDeleteOptions != null) { + timeout = poolDeleteOptions.timeout(); + } + UUID clientRequestId = null; + if (poolDeleteOptions != null) { + clientRequestId = poolDeleteOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolDeleteOptions != null) { + returnClientRequestId = poolDeleteOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolDeleteOptions != null) { + ocpDate = poolDeleteOptions.ocpDate(); + } + String ifMatch = null; + if (poolDeleteOptions != null) { + ifMatch = poolDeleteOptions.ifMatch(); + } + String ifNoneMatch = null; + if (poolDeleteOptions != null) { + ifNoneMatch = poolDeleteOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (poolDeleteOptions != null) { + ifModifiedSince = poolDeleteOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (poolDeleteOptions != null) { + ifUnmodifiedSince = poolDeleteOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.delete(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders deleteDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolDeleteHeaders.class); + } + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean exists(String poolId) { + return existsWithServiceResponseAsync(poolId).toBlocking().single().body(); + } + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @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 existsAsync(String poolId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(existsWithServiceResponseAsync(poolId), serviceCallback); + } + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable existsAsync(String poolId) { + return existsWithServiceResponseAsync(poolId).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> existsWithServiceResponseAsync(String poolId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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 PoolExistsOptions poolExistsOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.exists(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = existsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @param poolExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean exists(String poolId, PoolExistsOptions poolExistsOptions) { + return existsWithServiceResponseAsync(poolId, poolExistsOptions).toBlocking().single().body(); + } + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @param poolExistsOptions Additional parameters for the operation + * @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 existsAsync(String poolId, PoolExistsOptions poolExistsOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(existsWithServiceResponseAsync(poolId, poolExistsOptions), serviceCallback); + } + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @param poolExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable existsAsync(String poolId, PoolExistsOptions poolExistsOptions) { + return existsWithServiceResponseAsync(poolId, poolExistsOptions).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets basic properties of a pool. + * + * @param poolId The ID of the pool to get. + * @param poolExistsOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> existsWithServiceResponseAsync(String poolId, PoolExistsOptions poolExistsOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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(poolExistsOptions); + Integer timeout = null; + if (poolExistsOptions != null) { + timeout = poolExistsOptions.timeout(); + } + UUID clientRequestId = null; + if (poolExistsOptions != null) { + clientRequestId = poolExistsOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolExistsOptions != null) { + returnClientRequestId = poolExistsOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolExistsOptions != null) { + ocpDate = poolExistsOptions.ocpDate(); + } + String ifMatch = null; + if (poolExistsOptions != null) { + ifMatch = poolExistsOptions.ifMatch(); + } + String ifNoneMatch = null; + if (poolExistsOptions != null) { + ifNoneMatch = poolExistsOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (poolExistsOptions != null) { + ifModifiedSince = poolExistsOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (poolExistsOptions != null) { + ifUnmodifiedSince = poolExistsOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.exists(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = existsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders existsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildEmptyWithHeaders(response, PoolExistsHeaders.class); + } + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudPool object if successful. + */ + public CloudPool get(String poolId) { + return getWithServiceResponseAsync(poolId).toBlocking().single().body(); + } + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @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 poolId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(poolId), serviceCallback); + } + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudPool object + */ + public Observable getAsync(String poolId) { + return getWithServiceResponseAsync(poolId).map(new Func1, CloudPool>() { + @Override + public CloudPool call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudPool object + */ + public Observable> getWithServiceResponseAsync(String poolId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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 PoolGetOptions poolGetOptions = null; + String select = null; + String expand = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.get(poolId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @param poolGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudPool object if successful. + */ + public CloudPool get(String poolId, PoolGetOptions poolGetOptions) { + return getWithServiceResponseAsync(poolId, poolGetOptions).toBlocking().single().body(); + } + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @param poolGetOptions Additional parameters for the operation + * @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 poolId, PoolGetOptions poolGetOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(poolId, poolGetOptions), serviceCallback); + } + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @param poolGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudPool object + */ + public Observable getAsync(String poolId, PoolGetOptions poolGetOptions) { + return getWithServiceResponseAsync(poolId, poolGetOptions).map(new Func1, CloudPool>() { + @Override + public CloudPool call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified pool. + * + * @param poolId The ID of the pool to get. + * @param poolGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudPool object + */ + public Observable> getWithServiceResponseAsync(String poolId, PoolGetOptions poolGetOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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(poolGetOptions); + String select = null; + if (poolGetOptions != null) { + select = poolGetOptions.select(); + } + String expand = null; + if (poolGetOptions != null) { + expand = poolGetOptions.expand(); + } + Integer timeout = null; + if (poolGetOptions != null) { + timeout = poolGetOptions.timeout(); + } + UUID clientRequestId = null; + if (poolGetOptions != null) { + clientRequestId = poolGetOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolGetOptions != null) { + returnClientRequestId = poolGetOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolGetOptions != null) { + ocpDate = poolGetOptions.ocpDate(); + } + String ifMatch = null; + if (poolGetOptions != null) { + ifMatch = poolGetOptions.ifMatch(); + } + String ifNoneMatch = null; + if (poolGetOptions != null) { + ifNoneMatch = poolGetOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (poolGetOptions != null) { + ifModifiedSince = poolGetOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (poolGetOptions != null) { + ifUnmodifiedSince = poolGetOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.get(poolId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolGetHeaders.class); + } + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void patch(String poolId, PoolPatchParameter poolPatchParameter) { + patchWithServiceResponseAsync(poolId, poolPatchParameter).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter 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 patchAsync(String poolId, PoolPatchParameter poolPatchParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(patchWithServiceResponseAsync(poolId, poolPatchParameter), serviceCallback); + } + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable patchAsync(String poolId, PoolPatchParameter poolPatchParameter) { + return patchWithServiceResponseAsync(poolId, poolPatchParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> patchWithServiceResponseAsync(String poolId, PoolPatchParameter poolPatchParameter) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (poolPatchParameter == null) { + throw new IllegalArgumentException("Parameter poolPatchParameter 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(poolPatchParameter); + final PoolPatchOptions poolPatchOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.patch(poolId, poolPatchParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = patchDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @param poolPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void patch(String poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions) { + patchWithServiceResponseAsync(poolId, poolPatchParameter, poolPatchOptions).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @param poolPatchOptions Additional parameters for the operation + * @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 patchAsync(String poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(patchWithServiceResponseAsync(poolId, poolPatchParameter, poolPatchOptions), serviceCallback); + } + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @param poolPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable patchAsync(String poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions) { + return patchWithServiceResponseAsync(poolId, poolPatchParameter, poolPatchOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified pool. + * This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolPatchParameter The parameters for the request. + * @param poolPatchOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> patchWithServiceResponseAsync(String poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (poolPatchParameter == null) { + throw new IllegalArgumentException("Parameter poolPatchParameter 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(poolPatchParameter); + Validator.validate(poolPatchOptions); + Integer timeout = null; + if (poolPatchOptions != null) { + timeout = poolPatchOptions.timeout(); + } + UUID clientRequestId = null; + if (poolPatchOptions != null) { + clientRequestId = poolPatchOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolPatchOptions != null) { + returnClientRequestId = poolPatchOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolPatchOptions != null) { + ocpDate = poolPatchOptions.ocpDate(); + } + String ifMatch = null; + if (poolPatchOptions != null) { + ifMatch = poolPatchOptions.ifMatch(); + } + String ifNoneMatch = null; + if (poolPatchOptions != null) { + ifNoneMatch = poolPatchOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (poolPatchOptions != null) { + ifModifiedSince = poolPatchOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (poolPatchOptions != null) { + ifUnmodifiedSince = poolPatchOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.patch(poolId, poolPatchParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = patchDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders patchDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolPatchHeaders.class); + } + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void disableAutoScale(String poolId) { + disableAutoScaleWithServiceResponseAsync(poolId).toBlocking().single().body(); + } + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @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 disableAutoScaleAsync(String poolId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(disableAutoScaleWithServiceResponseAsync(poolId), serviceCallback); + } + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable disableAutoScaleAsync(String poolId) { + return disableAutoScaleWithServiceResponseAsync(poolId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> disableAutoScaleWithServiceResponseAsync(String poolId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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 PoolDisableAutoScaleOptions poolDisableAutoScaleOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.disableAutoScale(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = disableAutoScaleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @param poolDisableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void disableAutoScale(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions) { + disableAutoScaleWithServiceResponseAsync(poolId, poolDisableAutoScaleOptions).toBlocking().single().body(); + } + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @param poolDisableAutoScaleOptions Additional parameters for the operation + * @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 disableAutoScaleAsync(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(disableAutoScaleWithServiceResponseAsync(poolId, poolDisableAutoScaleOptions), serviceCallback); + } + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @param poolDisableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable disableAutoScaleAsync(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions) { + return disableAutoScaleWithServiceResponseAsync(poolId, poolDisableAutoScaleOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Disables automatic scaling for a pool. + * + * @param poolId The ID of the pool on which to disable automatic scaling. + * @param poolDisableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> disableAutoScaleWithServiceResponseAsync(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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(poolDisableAutoScaleOptions); + Integer timeout = null; + if (poolDisableAutoScaleOptions != null) { + timeout = poolDisableAutoScaleOptions.timeout(); + } + UUID clientRequestId = null; + if (poolDisableAutoScaleOptions != null) { + clientRequestId = poolDisableAutoScaleOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolDisableAutoScaleOptions != null) { + returnClientRequestId = poolDisableAutoScaleOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolDisableAutoScaleOptions != null) { + ocpDate = poolDisableAutoScaleOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.disableAutoScale(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = disableAutoScaleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders disableAutoScaleDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolDisableAutoScaleHeaders.class); + } + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enableAutoScale(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter) { + enableAutoScaleWithServiceResponseAsync(poolId, poolEnableAutoScaleParameter).toBlocking().single().body(); + } + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter 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 enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(enableAutoScaleWithServiceResponseAsync(poolId, poolEnableAutoScaleParameter), serviceCallback); + } + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter) { + return enableAutoScaleWithServiceResponseAsync(poolId, poolEnableAutoScaleParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> enableAutoScaleWithServiceResponseAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (poolEnableAutoScaleParameter == null) { + throw new IllegalArgumentException("Parameter poolEnableAutoScaleParameter 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(poolEnableAutoScaleParameter); + final PoolEnableAutoScaleOptions poolEnableAutoScaleOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.enableAutoScale(poolId, poolEnableAutoScaleParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = enableAutoScaleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @param poolEnableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enableAutoScale(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, PoolEnableAutoScaleOptions poolEnableAutoScaleOptions) { + enableAutoScaleWithServiceResponseAsync(poolId, poolEnableAutoScaleParameter, poolEnableAutoScaleOptions).toBlocking().single().body(); + } + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @param poolEnableAutoScaleOptions Additional parameters for the operation + * @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 enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, PoolEnableAutoScaleOptions poolEnableAutoScaleOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(enableAutoScaleWithServiceResponseAsync(poolId, poolEnableAutoScaleParameter, poolEnableAutoScaleOptions), serviceCallback); + } + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @param poolEnableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, PoolEnableAutoScaleOptions poolEnableAutoScaleOptions) { + return enableAutoScaleWithServiceResponseAsync(poolId, poolEnableAutoScaleParameter, poolEnableAutoScaleOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Enables automatic scaling for a pool. + * You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds. + * + * @param poolId The ID of the pool on which to enable automatic scaling. + * @param poolEnableAutoScaleParameter The parameters for the request. + * @param poolEnableAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> enableAutoScaleWithServiceResponseAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, PoolEnableAutoScaleOptions poolEnableAutoScaleOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (poolEnableAutoScaleParameter == null) { + throw new IllegalArgumentException("Parameter poolEnableAutoScaleParameter 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(poolEnableAutoScaleParameter); + Validator.validate(poolEnableAutoScaleOptions); + Integer timeout = null; + if (poolEnableAutoScaleOptions != null) { + timeout = poolEnableAutoScaleOptions.timeout(); + } + UUID clientRequestId = null; + if (poolEnableAutoScaleOptions != null) { + clientRequestId = poolEnableAutoScaleOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolEnableAutoScaleOptions != null) { + returnClientRequestId = poolEnableAutoScaleOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolEnableAutoScaleOptions != null) { + ocpDate = poolEnableAutoScaleOptions.ocpDate(); + } + String ifMatch = null; + if (poolEnableAutoScaleOptions != null) { + ifMatch = poolEnableAutoScaleOptions.ifMatch(); + } + String ifNoneMatch = null; + if (poolEnableAutoScaleOptions != null) { + ifNoneMatch = poolEnableAutoScaleOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (poolEnableAutoScaleOptions != null) { + ifModifiedSince = poolEnableAutoScaleOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (poolEnableAutoScaleOptions != null) { + ifUnmodifiedSince = poolEnableAutoScaleOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.enableAutoScale(poolId, poolEnableAutoScaleParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = enableAutoScaleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders enableAutoScaleDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolEnableAutoScaleHeaders.class); + } + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AutoScaleRun object if successful. + */ + public AutoScaleRun evaluateAutoScale(String poolId, String autoScaleFormula) { + return evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula).toBlocking().single().body(); + } + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @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 evaluateAutoScaleAsync(String poolId, String autoScaleFormula, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula), serviceCallback); + } + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoScaleRun object + */ + public Observable evaluateAutoScaleAsync(String poolId, String autoScaleFormula) { + return evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula).map(new Func1, AutoScaleRun>() { + @Override + public AutoScaleRun call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoScaleRun object + */ + public Observable> evaluateAutoScaleWithServiceResponseAsync(String poolId, String autoScaleFormula) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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 (autoScaleFormula == null) { + throw new IllegalArgumentException("Parameter autoScaleFormula is required and cannot be null."); + } + final PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + PoolEvaluateAutoScaleParameter poolEvaluateAutoScaleParameter = new PoolEvaluateAutoScaleParameter(); + poolEvaluateAutoScaleParameter.withAutoScaleFormula(autoScaleFormula); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.evaluateAutoScale(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, poolEvaluateAutoScaleParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = evaluateAutoScaleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @param poolEvaluateAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AutoScaleRun object if successful. + */ + public AutoScaleRun evaluateAutoScale(String poolId, String autoScaleFormula, PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions) { + return evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula, poolEvaluateAutoScaleOptions).toBlocking().single().body(); + } + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @param poolEvaluateAutoScaleOptions Additional parameters for the operation + * @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 evaluateAutoScaleAsync(String poolId, String autoScaleFormula, PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula, poolEvaluateAutoScaleOptions), serviceCallback); + } + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @param poolEvaluateAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoScaleRun object + */ + public Observable evaluateAutoScaleAsync(String poolId, String autoScaleFormula, PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions) { + return evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula, poolEvaluateAutoScaleOptions).map(new Func1, AutoScaleRun>() { + @Override + public AutoScaleRun call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the result of evaluating an automatic scaling formula on the pool. + * This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula. + * + * @param poolId The ID of the pool on which to evaluate the automatic scaling formula. + * @param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * @param poolEvaluateAutoScaleOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoScaleRun object + */ + public Observable> evaluateAutoScaleWithServiceResponseAsync(String poolId, String autoScaleFormula, PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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 (autoScaleFormula == null) { + throw new IllegalArgumentException("Parameter autoScaleFormula is required and cannot be null."); + } + Validator.validate(poolEvaluateAutoScaleOptions); + Integer timeout = null; + if (poolEvaluateAutoScaleOptions != null) { + timeout = poolEvaluateAutoScaleOptions.timeout(); + } + UUID clientRequestId = null; + if (poolEvaluateAutoScaleOptions != null) { + clientRequestId = poolEvaluateAutoScaleOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolEvaluateAutoScaleOptions != null) { + returnClientRequestId = poolEvaluateAutoScaleOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolEvaluateAutoScaleOptions != null) { + ocpDate = poolEvaluateAutoScaleOptions.ocpDate(); + } + PoolEvaluateAutoScaleParameter poolEvaluateAutoScaleParameter = new PoolEvaluateAutoScaleParameter(); + poolEvaluateAutoScaleParameter.withAutoScaleFormula(autoScaleFormula); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.evaluateAutoScale(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, poolEvaluateAutoScaleParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = evaluateAutoScaleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders evaluateAutoScaleDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolEvaluateAutoScaleHeaders.class); + } + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void resize(String poolId, PoolResizeParameter poolResizeParameter) { + resizeWithServiceResponseAsync(poolId, poolResizeParameter).toBlocking().single().body(); + } + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter 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 resizeAsync(String poolId, PoolResizeParameter poolResizeParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(resizeWithServiceResponseAsync(poolId, poolResizeParameter), serviceCallback); + } + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable resizeAsync(String poolId, PoolResizeParameter poolResizeParameter) { + return resizeWithServiceResponseAsync(poolId, poolResizeParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> resizeWithServiceResponseAsync(String poolId, PoolResizeParameter poolResizeParameter) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (poolResizeParameter == null) { + throw new IllegalArgumentException("Parameter poolResizeParameter 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(poolResizeParameter); + final PoolResizeOptions poolResizeOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.resize(poolId, poolResizeParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = resizeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @param poolResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void resize(String poolId, PoolResizeParameter poolResizeParameter, PoolResizeOptions poolResizeOptions) { + resizeWithServiceResponseAsync(poolId, poolResizeParameter, poolResizeOptions).toBlocking().single().body(); + } + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @param poolResizeOptions Additional parameters for the operation + * @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 resizeAsync(String poolId, PoolResizeParameter poolResizeParameter, PoolResizeOptions poolResizeOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(resizeWithServiceResponseAsync(poolId, poolResizeParameter, poolResizeOptions), serviceCallback); + } + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @param poolResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable resizeAsync(String poolId, PoolResizeParameter poolResizeParameter, PoolResizeOptions poolResizeOptions) { + return resizeWithServiceResponseAsync(poolId, poolResizeParameter, poolResizeOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Changes the number of compute nodes that are assigned to a pool. + * You can only resize a pool when its allocation state is steady. If the pool is already resizing, the request fails with status code 409. When you resize a pool, the pool's allocation state changes from steady to resizing. You cannot resize pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a pool downwards, the Batch service chooses which nodes to remove. To remove specific nodes, use the pool remove nodes API instead. + * + * @param poolId The ID of the pool to resize. + * @param poolResizeParameter The parameters for the request. + * @param poolResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> resizeWithServiceResponseAsync(String poolId, PoolResizeParameter poolResizeParameter, PoolResizeOptions poolResizeOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (poolResizeParameter == null) { + throw new IllegalArgumentException("Parameter poolResizeParameter 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(poolResizeParameter); + Validator.validate(poolResizeOptions); + Integer timeout = null; + if (poolResizeOptions != null) { + timeout = poolResizeOptions.timeout(); + } + UUID clientRequestId = null; + if (poolResizeOptions != null) { + clientRequestId = poolResizeOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolResizeOptions != null) { + returnClientRequestId = poolResizeOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolResizeOptions != null) { + ocpDate = poolResizeOptions.ocpDate(); + } + String ifMatch = null; + if (poolResizeOptions != null) { + ifMatch = poolResizeOptions.ifMatch(); + } + String ifNoneMatch = null; + if (poolResizeOptions != null) { + ifNoneMatch = poolResizeOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (poolResizeOptions != null) { + ifModifiedSince = poolResizeOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (poolResizeOptions != null) { + ifUnmodifiedSince = poolResizeOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.resize(poolId, poolResizeParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = resizeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders resizeDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolResizeHeaders.class); + } + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void stopResize(String poolId) { + stopResizeWithServiceResponseAsync(poolId).toBlocking().single().body(); + } + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @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 stopResizeAsync(String poolId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(stopResizeWithServiceResponseAsync(poolId), serviceCallback); + } + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable stopResizeAsync(String poolId) { + return stopResizeWithServiceResponseAsync(poolId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> stopResizeWithServiceResponseAsync(String poolId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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 PoolStopResizeOptions poolStopResizeOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.stopResize(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = stopResizeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @param poolStopResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void stopResize(String poolId, PoolStopResizeOptions poolStopResizeOptions) { + stopResizeWithServiceResponseAsync(poolId, poolStopResizeOptions).toBlocking().single().body(); + } + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @param poolStopResizeOptions Additional parameters for the operation + * @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 stopResizeAsync(String poolId, PoolStopResizeOptions poolStopResizeOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(stopResizeWithServiceResponseAsync(poolId, poolStopResizeOptions), serviceCallback); + } + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @param poolStopResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable stopResizeAsync(String poolId, PoolStopResizeOptions poolStopResizeOptions) { + return stopResizeWithServiceResponseAsync(poolId, poolStopResizeOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Stops an ongoing resize operation on the pool. + * This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. + * + * @param poolId The ID of the pool whose resizing you want to stop. + * @param poolStopResizeOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> stopResizeWithServiceResponseAsync(String poolId, PoolStopResizeOptions poolStopResizeOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId 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(poolStopResizeOptions); + Integer timeout = null; + if (poolStopResizeOptions != null) { + timeout = poolStopResizeOptions.timeout(); + } + UUID clientRequestId = null; + if (poolStopResizeOptions != null) { + clientRequestId = poolStopResizeOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolStopResizeOptions != null) { + returnClientRequestId = poolStopResizeOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolStopResizeOptions != null) { + ocpDate = poolStopResizeOptions.ocpDate(); + } + String ifMatch = null; + if (poolStopResizeOptions != null) { + ifMatch = poolStopResizeOptions.ifMatch(); + } + String ifNoneMatch = null; + if (poolStopResizeOptions != null) { + ifNoneMatch = poolStopResizeOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (poolStopResizeOptions != null) { + ifModifiedSince = poolStopResizeOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (poolStopResizeOptions != null) { + ifUnmodifiedSince = poolStopResizeOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.stopResize(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = stopResizeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders stopResizeDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolStopResizeHeaders.class); + } + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void updateProperties(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter) { + updatePropertiesWithServiceResponseAsync(poolId, poolUpdatePropertiesParameter).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter 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 updatePropertiesAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updatePropertiesWithServiceResponseAsync(poolId, poolUpdatePropertiesParameter), serviceCallback); + } + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable updatePropertiesAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter) { + return updatePropertiesWithServiceResponseAsync(poolId, poolUpdatePropertiesParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> updatePropertiesWithServiceResponseAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (poolUpdatePropertiesParameter == null) { + throw new IllegalArgumentException("Parameter poolUpdatePropertiesParameter 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(poolUpdatePropertiesParameter); + final PoolUpdatePropertiesOptions poolUpdatePropertiesOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.updateProperties(poolId, poolUpdatePropertiesParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updatePropertiesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @param poolUpdatePropertiesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void updateProperties(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, PoolUpdatePropertiesOptions poolUpdatePropertiesOptions) { + updatePropertiesWithServiceResponseAsync(poolId, poolUpdatePropertiesParameter, poolUpdatePropertiesOptions).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @param poolUpdatePropertiesOptions Additional parameters for the operation + * @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 updatePropertiesAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, PoolUpdatePropertiesOptions poolUpdatePropertiesOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updatePropertiesWithServiceResponseAsync(poolId, poolUpdatePropertiesParameter, poolUpdatePropertiesOptions), serviceCallback); + } + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @param poolUpdatePropertiesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable updatePropertiesAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, PoolUpdatePropertiesOptions poolUpdatePropertiesOptions) { + return updatePropertiesWithServiceResponseAsync(poolId, poolUpdatePropertiesParameter, poolUpdatePropertiesOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified pool. + * This fully replaces all the updatable properties of the pool. For example, if the pool has a start task associated with it and if start task is not specified with this request, then the Batch service will remove the existing start task. + * + * @param poolId The ID of the pool to update. + * @param poolUpdatePropertiesParameter The parameters for the request. + * @param poolUpdatePropertiesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> updatePropertiesWithServiceResponseAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, PoolUpdatePropertiesOptions poolUpdatePropertiesOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (poolUpdatePropertiesParameter == null) { + throw new IllegalArgumentException("Parameter poolUpdatePropertiesParameter 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(poolUpdatePropertiesParameter); + Validator.validate(poolUpdatePropertiesOptions); + Integer timeout = null; + if (poolUpdatePropertiesOptions != null) { + timeout = poolUpdatePropertiesOptions.timeout(); + } + UUID clientRequestId = null; + if (poolUpdatePropertiesOptions != null) { + clientRequestId = poolUpdatePropertiesOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolUpdatePropertiesOptions != null) { + returnClientRequestId = poolUpdatePropertiesOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolUpdatePropertiesOptions != null) { + ocpDate = poolUpdatePropertiesOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.updateProperties(poolId, poolUpdatePropertiesParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updatePropertiesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders updatePropertiesDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolUpdatePropertiesHeaders.class); + } + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void removeNodes(String poolId, NodeRemoveParameter nodeRemoveParameter) { + removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter).toBlocking().single().body(); + } + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter 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 removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter), serviceCallback); + } + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter) { + return removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> removeNodesWithServiceResponseAsync(String poolId, NodeRemoveParameter nodeRemoveParameter) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeRemoveParameter == null) { + throw new IllegalArgumentException("Parameter nodeRemoveParameter 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(nodeRemoveParameter); + final PoolRemoveNodesOptions poolRemoveNodesOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.removeNodes(poolId, nodeRemoveParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = removeNodesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @param poolRemoveNodesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void removeNodes(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions) { + removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter, poolRemoveNodesOptions).toBlocking().single().body(); + } + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @param poolRemoveNodesOptions Additional parameters for the operation + * @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 removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter, poolRemoveNodesOptions), serviceCallback); + } + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @param poolRemoveNodesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions) { + return removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter, poolRemoveNodesOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Removes compute nodes from the specified pool. + * This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. + * + * @param poolId The ID of the pool from which you want to remove nodes. + * @param nodeRemoveParameter The parameters for the request. + * @param poolRemoveNodesOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> removeNodesWithServiceResponseAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (poolId == null) { + throw new IllegalArgumentException("Parameter poolId is required and cannot be null."); + } + if (nodeRemoveParameter == null) { + throw new IllegalArgumentException("Parameter nodeRemoveParameter 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(nodeRemoveParameter); + Validator.validate(poolRemoveNodesOptions); + Integer timeout = null; + if (poolRemoveNodesOptions != null) { + timeout = poolRemoveNodesOptions.timeout(); + } + UUID clientRequestId = null; + if (poolRemoveNodesOptions != null) { + clientRequestId = poolRemoveNodesOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolRemoveNodesOptions != null) { + returnClientRequestId = poolRemoveNodesOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolRemoveNodesOptions != null) { + ocpDate = poolRemoveNodesOptions.ocpDate(); + } + String ifMatch = null; + if (poolRemoveNodesOptions != null) { + ifMatch = poolRemoveNodesOptions.ifMatch(); + } + String ifNoneMatch = null; + if (poolRemoveNodesOptions != null) { + ifNoneMatch = poolRemoveNodesOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (poolRemoveNodesOptions != null) { + ifModifiedSince = poolRemoveNodesOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (poolRemoveNodesOptions != null) { + ifUnmodifiedSince = poolRemoveNodesOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.removeNodes(poolId, nodeRemoveParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = removeNodesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders removeNodesDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolRemoveNodesHeaders.class); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolUsageMetrics> object if successful. + */ + public PagedList listUsageMetricsNext(final String nextPageLink) { + ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response = listUsageMetricsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listUsageMetricsNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @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> listUsageMetricsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listUsageMetricsNextSinglePageAsync(nextPageLink), + new Func1, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(String nextPageLink) { + return listUsageMetricsNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @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<PoolUsageMetrics> object + */ + public Observable> listUsageMetricsNextAsync(final String nextPageLink) { + return listUsageMetricsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, PoolListUsageMetricsHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @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<PoolUsageMetrics> object + */ + public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsNextWithServiceResponseAsync(final String nextPageLink) { + return listUsageMetricsNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, PoolListUsageMetricsHeaders>, Observable, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listUsageMetricsNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PoolUsageMetrics> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listUsageMetricsNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> result = listUsageMetricsNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, PoolListUsageMetricsHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListUsageMetricsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<PoolUsageMetrics> object if successful. + */ + public PagedList listUsageMetricsNext(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions) { + ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response = listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListUsageMetricsNextOptions Additional parameters for the 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> listUsageMetricsNextAsync(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions), + new Func1, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(String nextPageLink) { + return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListUsageMetricsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + public Observable> listUsageMetricsNextAsync(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions) { + return listUsageMetricsNextWithServiceResponseAsync(nextPageLink, poolListUsageMetricsNextOptions) + .map(new Func1, PoolListUsageMetricsHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListUsageMetricsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PoolUsageMetrics> object + */ + public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsNextWithServiceResponseAsync(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions) { + return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions) + .concatMap(new Func1, PoolListUsageMetricsHeaders>, Observable, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listUsageMetricsNextWithServiceResponseAsync(nextPageLink, poolListUsageMetricsNextOptions)); + } + }); + } + + /** + * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. + * If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. + * + ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> * @param poolListUsageMetricsNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PoolUsageMetrics> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsNextSinglePageAsync(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(poolListUsageMetricsNextOptions); + UUID clientRequestId = null; + if (poolListUsageMetricsNextOptions != null) { + clientRequestId = poolListUsageMetricsNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolListUsageMetricsNextOptions != null) { + returnClientRequestId = poolListUsageMetricsNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolListUsageMetricsNextOptions != null) { + ocpDate = poolListUsageMetricsNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listUsageMetricsNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, PoolListUsageMetricsHeaders>>>() { + @Override + public Observable, PoolListUsageMetricsHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> result = listUsageMetricsNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, PoolListUsageMetricsHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> listUsageMetricsNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolListUsageMetricsHeaders.class); + } + + /** + * Lists all of the pools 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 BatchErrorException 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<CloudPool> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponseWithHeaders, PoolListHeaders> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the pools 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.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the pools 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<CloudPool> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, PoolListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, PoolListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the pools 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<CloudPool> object + */ + public Observable, PoolListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, PoolListHeaders>, Observable, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(ServiceResponseWithHeaders, PoolListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the pools 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 PagedList<CloudPool> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, PoolListHeaders>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final PoolListNextOptions poolListNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, PoolListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, PoolListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the pools in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudPool> object if successful. + */ + public PagedList listNext(final String nextPageLink, final PoolListNextOptions poolListNextOptions) { + ServiceResponseWithHeaders, PoolListHeaders> response = listNextSinglePageAsync(nextPageLink, poolListNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, poolListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the pools in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListNextOptions Additional parameters for the 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 PoolListNextOptions poolListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink, poolListNextOptions), + new Func1, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, poolListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the pools in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + public Observable> listNextAsync(final String nextPageLink, final PoolListNextOptions poolListNextOptions) { + return listNextWithServiceResponseAsync(nextPageLink, poolListNextOptions) + .map(new Func1, PoolListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, PoolListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the pools in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param poolListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudPool> object + */ + public Observable, PoolListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final PoolListNextOptions poolListNextOptions) { + return listNextSinglePageAsync(nextPageLink, poolListNextOptions) + .concatMap(new Func1, PoolListHeaders>, Observable, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(ServiceResponseWithHeaders, PoolListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, poolListNextOptions)); + } + }); + } + + /** + * Lists all of the pools in the specified account. + * + ServiceResponseWithHeaders, PoolListHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, PoolListHeaders> * @param poolListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudPool> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, PoolListHeaders>> listNextSinglePageAsync(final String nextPageLink, final PoolListNextOptions poolListNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(poolListNextOptions); + UUID clientRequestId = null; + if (poolListNextOptions != null) { + clientRequestId = poolListNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (poolListNextOptions != null) { + returnClientRequestId = poolListNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (poolListNextOptions != null) { + ocpDate = poolListNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, PoolListHeaders>>>() { + @Override + public Observable, PoolListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, PoolListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, PoolListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, PoolListHeaders> listNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, PoolListHeaders.class); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java new file mode 100644 index 000000000000..1c3fc5963851 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java @@ -0,0 +1,2568 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.batch.protocol.Tasks; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.batch.protocol.models.BatchErrorException; +import com.microsoft.azure.batch.protocol.models.CloudTask; +import com.microsoft.azure.batch.protocol.models.CloudTaskListSubtasksResult; +import com.microsoft.azure.batch.protocol.models.PageImpl; +import com.microsoft.azure.batch.protocol.models.TaskAddCollectionHeaders; +import com.microsoft.azure.batch.protocol.models.TaskAddCollectionOptions; +import com.microsoft.azure.batch.protocol.models.TaskAddCollectionParameter; +import com.microsoft.azure.batch.protocol.models.TaskAddCollectionResult; +import com.microsoft.azure.batch.protocol.models.TaskAddHeaders; +import com.microsoft.azure.batch.protocol.models.TaskAddOptions; +import com.microsoft.azure.batch.protocol.models.TaskAddParameter; +import com.microsoft.azure.batch.protocol.models.TaskConstraints; +import com.microsoft.azure.batch.protocol.models.TaskDeleteHeaders; +import com.microsoft.azure.batch.protocol.models.TaskDeleteOptions; +import com.microsoft.azure.batch.protocol.models.TaskGetHeaders; +import com.microsoft.azure.batch.protocol.models.TaskGetOptions; +import com.microsoft.azure.batch.protocol.models.TaskListHeaders; +import com.microsoft.azure.batch.protocol.models.TaskListNextOptions; +import com.microsoft.azure.batch.protocol.models.TaskListOptions; +import com.microsoft.azure.batch.protocol.models.TaskListSubtasksHeaders; +import com.microsoft.azure.batch.protocol.models.TaskListSubtasksOptions; +import com.microsoft.azure.batch.protocol.models.TaskReactivateHeaders; +import com.microsoft.azure.batch.protocol.models.TaskReactivateOptions; +import com.microsoft.azure.batch.protocol.models.TaskTerminateHeaders; +import com.microsoft.azure.batch.protocol.models.TaskTerminateOptions; +import com.microsoft.azure.batch.protocol.models.TaskUpdateHeaders; +import com.microsoft.azure.batch.protocol.models.TaskUpdateOptions; +import com.microsoft.azure.batch.protocol.models.TaskUpdateParameter; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.DateTimeRfc1123; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +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.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 Tasks. + */ +public class TasksImpl implements Tasks { + /** The Retrofit service to perform REST calls. */ + private TasksService service; + /** The service client containing this operation class. */ + private BatchServiceClientImpl client; + + /** + * Initializes an instance of TasksImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TasksImpl(Retrofit retrofit, BatchServiceClientImpl client) { + this.service = retrofit.create(TasksService.class); + this.client = client; + } + + /** + * The interface defining all the services for Tasks to be + * used by Retrofit to perform actually REST calls. + */ + interface TasksService { + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Tasks add" }) + @POST("jobs/{jobId}/tasks") + Observable> add(@Path("jobId") String jobId, @Body TaskAddParameter task, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Tasks list" }) + @GET("jobs/{jobId}/tasks") + Observable> list(@Path("jobId") String jobId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("$select") String select, @Query("$expand") String expand, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Tasks addCollection" }) + @POST("jobs/{jobId}/addtaskcollection") + Observable> addCollection(@Path("jobId") String jobId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Body TaskAddCollectionParameter taskCollection, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Tasks delete" }) + @HTTP(path = "jobs/{jobId}/tasks/{taskId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("jobId") String jobId, @Path("taskId") String taskId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Tasks get" }) + @GET("jobs/{jobId}/tasks/{taskId}") + Observable> get(@Path("jobId") String jobId, @Path("taskId") String taskId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$select") String select, @Query("$expand") String expand, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Tasks update" }) + @PUT("jobs/{jobId}/tasks/{taskId}") + Observable> update(@Path("jobId") String jobId, @Path("taskId") String taskId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Body TaskUpdateParameter taskUpdateParameter, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Tasks listSubtasks" }) + @GET("jobs/{jobId}/tasks/{taskId}/subtasksinfo") + Observable> listSubtasks(@Path("jobId") String jobId, @Path("taskId") String taskId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$select") String select, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Tasks terminate" }) + @POST("jobs/{jobId}/tasks/{taskId}/terminate") + Observable> terminate(@Path("jobId") String jobId, @Path("taskId") String taskId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Tasks reactivate" }) + @POST("jobs/{jobId}/tasks/{taskId}/reactivate") + Observable> reactivate(@Path("jobId") String jobId, @Path("taskId") String taskId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Tasks listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent); + + } + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void add(String jobId, TaskAddParameter task) { + addWithServiceResponseAsync(jobId, task).toBlocking().single().body(); + } + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @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 addAsync(String jobId, TaskAddParameter task, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(jobId, task), serviceCallback); + } + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addAsync(String jobId, TaskAddParameter task) { + return addWithServiceResponseAsync(jobId, task).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addWithServiceResponseAsync(String jobId, TaskAddParameter task) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (task == null) { + throw new IllegalArgumentException("Parameter task 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(task); + final TaskAddOptions taskAddOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.add(jobId, task, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @param taskAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void add(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions) { + addWithServiceResponseAsync(jobId, task, taskAddOptions).toBlocking().single().body(); + } + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @param taskAddOptions Additional parameters for the operation + * @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 addAsync(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(jobId, task, taskAddOptions), serviceCallback); + } + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @param taskAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable addAsync(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions) { + return addWithServiceResponseAsync(jobId, task, taskAddOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a task to the specified job. + * The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task is to be added. + * @param task The task to be added. + * @param taskAddOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> addWithServiceResponseAsync(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (task == null) { + throw new IllegalArgumentException("Parameter task 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(task); + Validator.validate(taskAddOptions); + Integer timeout = null; + if (taskAddOptions != null) { + timeout = taskAddOptions.timeout(); + } + UUID clientRequestId = null; + if (taskAddOptions != null) { + clientRequestId = taskAddOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (taskAddOptions != null) { + returnClientRequestId = taskAddOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (taskAddOptions != null) { + ocpDate = taskAddOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.add(jobId, task, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders addDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, TaskAddHeaders.class); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudTask> object if successful. + */ + public PagedList list(final String jobId) { + ServiceResponseWithHeaders, TaskListHeaders> response = listSinglePageAsync(jobId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @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 jobId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(jobId), + new Func1, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + public Observable> listAsync(final String jobId) { + return listWithServiceResponseAsync(jobId) + .map(new Func1, TaskListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, TaskListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + public Observable, TaskListHeaders>> listWithServiceResponseAsync(final String jobId) { + return listSinglePageAsync(jobId) + .concatMap(new Func1, TaskListHeaders>, Observable, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(ServiceResponseWithHeaders, TaskListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudTask> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, TaskListHeaders>> listSinglePageAsync(final String jobId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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 TaskListOptions taskListOptions = null; + String filter = null; + String select = null; + String expand = null; + Integer maxResults = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(jobId, this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, TaskListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, TaskListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @param taskListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudTask> object if successful. + */ + public PagedList list(final String jobId, final TaskListOptions taskListOptions) { + ServiceResponseWithHeaders, TaskListHeaders> response = listSinglePageAsync(jobId, taskListOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + TaskListNextOptions taskListNextOptions = null; + if (taskListOptions != null) { + taskListNextOptions = new TaskListNextOptions(); + taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId()); + taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId()); + taskListNextOptions.withOcpDate(taskListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, taskListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @param taskListOptions Additional parameters for the operation + * @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 jobId, final TaskListOptions taskListOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listSinglePageAsync(jobId, taskListOptions), + new Func1, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(String nextPageLink) { + TaskListNextOptions taskListNextOptions = null; + if (taskListOptions != null) { + taskListNextOptions = new TaskListNextOptions(); + taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId()); + taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId()); + taskListNextOptions.withOcpDate(taskListOptions.ocpDate()); + } + return listNextSinglePageAsync(nextPageLink, taskListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @param taskListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + public Observable> listAsync(final String jobId, final TaskListOptions taskListOptions) { + return listWithServiceResponseAsync(jobId, taskListOptions) + .map(new Func1, TaskListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, TaskListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job. + * @param taskListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + public Observable, TaskListHeaders>> listWithServiceResponseAsync(final String jobId, final TaskListOptions taskListOptions) { + return listSinglePageAsync(jobId, taskListOptions) + .concatMap(new Func1, TaskListHeaders>, Observable, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(ServiceResponseWithHeaders, TaskListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + TaskListNextOptions taskListNextOptions = null; + if (taskListOptions != null) { + taskListNextOptions = new TaskListNextOptions(); + taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId()); + taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId()); + taskListNextOptions.withOcpDate(taskListOptions.ocpDate()); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, taskListNextOptions)); + } + }); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + ServiceResponseWithHeaders, TaskListHeaders> * @param jobId The ID of the job. + ServiceResponseWithHeaders, TaskListHeaders> * @param taskListOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudTask> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, TaskListHeaders>> listSinglePageAsync(final String jobId, final TaskListOptions taskListOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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(taskListOptions); + String filter = null; + if (taskListOptions != null) { + filter = taskListOptions.filter(); + } + String select = null; + if (taskListOptions != null) { + select = taskListOptions.select(); + } + String expand = null; + if (taskListOptions != null) { + expand = taskListOptions.expand(); + } + Integer maxResults = null; + if (taskListOptions != null) { + maxResults = taskListOptions.maxResults(); + } + Integer timeout = null; + if (taskListOptions != null) { + timeout = taskListOptions.timeout(); + } + UUID clientRequestId = null; + if (taskListOptions != null) { + clientRequestId = taskListOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (taskListOptions != null) { + returnClientRequestId = taskListOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (taskListOptions != null) { + ocpDate = taskListOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.list(jobId, this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, TaskListHeaders> result = listDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, TaskListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, TaskListHeaders> listDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, TaskListHeaders.class); + } + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TaskAddCollectionResult object if successful. + */ + public TaskAddCollectionResult addCollection(String jobId, List value) { + return addCollectionWithServiceResponseAsync(jobId, value).toBlocking().single().body(); + } + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @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 addCollectionAsync(String jobId, List value, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addCollectionWithServiceResponseAsync(jobId, value), serviceCallback); + } + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskAddCollectionResult object + */ + public Observable addCollectionAsync(String jobId, List value) { + return addCollectionWithServiceResponseAsync(jobId, value).map(new Func1, TaskAddCollectionResult>() { + @Override + public TaskAddCollectionResult call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskAddCollectionResult object + */ + public Observable> addCollectionWithServiceResponseAsync(String jobId, List value) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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 (value == null) { + throw new IllegalArgumentException("Parameter value is required and cannot be null."); + } + Validator.validate(value); + final TaskAddCollectionOptions taskAddCollectionOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + TaskAddCollectionParameter taskCollection = new TaskAddCollectionParameter(); + taskCollection.withValue(value); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.addCollection(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, taskCollection, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addCollectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @param taskAddCollectionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TaskAddCollectionResult object if successful. + */ + public TaskAddCollectionResult addCollection(String jobId, List value, TaskAddCollectionOptions taskAddCollectionOptions) { + return addCollectionWithServiceResponseAsync(jobId, value, taskAddCollectionOptions).toBlocking().single().body(); + } + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @param taskAddCollectionOptions Additional parameters for the operation + * @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 addCollectionAsync(String jobId, List value, TaskAddCollectionOptions taskAddCollectionOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(addCollectionWithServiceResponseAsync(jobId, value, taskAddCollectionOptions), serviceCallback); + } + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @param taskAddCollectionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskAddCollectionResult object + */ + public Observable addCollectionAsync(String jobId, List value, TaskAddCollectionOptions taskAddCollectionOptions) { + return addCollectionWithServiceResponseAsync(jobId, value, taskAddCollectionOptions).map(new Func1, TaskAddCollectionResult>() { + @Override + public TaskAddCollectionResult call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Adds a collection of tasks to the specified job. + * Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. + * + * @param jobId The ID of the job to which the task collection is to be added. + * @param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * @param taskAddCollectionOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TaskAddCollectionResult object + */ + public Observable> addCollectionWithServiceResponseAsync(String jobId, List value, TaskAddCollectionOptions taskAddCollectionOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId 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 (value == null) { + throw new IllegalArgumentException("Parameter value is required and cannot be null."); + } + Validator.validate(value); + Validator.validate(taskAddCollectionOptions); + Integer timeout = null; + if (taskAddCollectionOptions != null) { + timeout = taskAddCollectionOptions.timeout(); + } + UUID clientRequestId = null; + if (taskAddCollectionOptions != null) { + clientRequestId = taskAddCollectionOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (taskAddCollectionOptions != null) { + returnClientRequestId = taskAddCollectionOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (taskAddCollectionOptions != null) { + ocpDate = taskAddCollectionOptions.ocpDate(); + } + TaskAddCollectionParameter taskCollection = new TaskAddCollectionParameter(); + taskCollection.withValue(value); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.addCollection(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, taskCollection, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = addCollectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders addCollectionDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, TaskAddCollectionHeaders.class); + } + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobId, String taskId) { + deleteWithServiceResponseAsync(jobId, taskId).toBlocking().single().body(); + } + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task 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 jobId, String taskId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(jobId, taskId), serviceCallback); + } + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteAsync(String jobId, String taskId) { + return deleteWithServiceResponseAsync(jobId, taskId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String jobId, String taskId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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 TaskDeleteOptions taskDeleteOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.delete(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @param taskDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobId, String taskId, TaskDeleteOptions taskDeleteOptions) { + deleteWithServiceResponseAsync(jobId, taskId, taskDeleteOptions).toBlocking().single().body(); + } + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @param taskDeleteOptions Additional parameters for the operation + * @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 jobId, String taskId, TaskDeleteOptions taskDeleteOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(jobId, taskId, taskDeleteOptions), serviceCallback); + } + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @param taskDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable deleteAsync(String jobId, String taskId, TaskDeleteOptions taskDeleteOptions) { + return deleteWithServiceResponseAsync(jobId, taskId, taskDeleteOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes a task from the specified job. + * When a task is deleted, all of the files in its directory on the compute node where it ran are also deleted (regardless of the retention time). For multi-instance tasks, the delete task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background. + * + * @param jobId The ID of the job from which to delete the task. + * @param taskId The ID of the task to delete. + * @param taskDeleteOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String jobId, String taskId, TaskDeleteOptions taskDeleteOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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(taskDeleteOptions); + Integer timeout = null; + if (taskDeleteOptions != null) { + timeout = taskDeleteOptions.timeout(); + } + UUID clientRequestId = null; + if (taskDeleteOptions != null) { + clientRequestId = taskDeleteOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (taskDeleteOptions != null) { + returnClientRequestId = taskDeleteOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (taskDeleteOptions != null) { + ocpDate = taskDeleteOptions.ocpDate(); + } + String ifMatch = null; + if (taskDeleteOptions != null) { + ifMatch = taskDeleteOptions.ifMatch(); + } + String ifNoneMatch = null; + if (taskDeleteOptions != null) { + ifNoneMatch = taskDeleteOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (taskDeleteOptions != null) { + ifModifiedSince = taskDeleteOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (taskDeleteOptions != null) { + ifUnmodifiedSince = taskDeleteOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.delete(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders deleteDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, TaskDeleteHeaders.class); + } + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudTask object if successful. + */ + public CloudTask get(String jobId, String taskId) { + return getWithServiceResponseAsync(jobId, taskId).toBlocking().single().body(); + } + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @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 jobId, String taskId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(jobId, taskId), serviceCallback); + } + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTask object + */ + public Observable getAsync(String jobId, String taskId) { + return getWithServiceResponseAsync(jobId, taskId).map(new Func1, CloudTask>() { + @Override + public CloudTask call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTask object + */ + public Observable> getWithServiceResponseAsync(String jobId, String taskId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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 TaskGetOptions taskGetOptions = null; + String select = null; + String expand = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.get(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @param taskGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudTask object if successful. + */ + public CloudTask get(String jobId, String taskId, TaskGetOptions taskGetOptions) { + return getWithServiceResponseAsync(jobId, taskId, taskGetOptions).toBlocking().single().body(); + } + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @param taskGetOptions Additional parameters for the operation + * @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 jobId, String taskId, TaskGetOptions taskGetOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(jobId, taskId, taskGetOptions), serviceCallback); + } + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @param taskGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTask object + */ + public Observable getAsync(String jobId, String taskId, TaskGetOptions taskGetOptions) { + return getWithServiceResponseAsync(jobId, taskId, taskGetOptions).map(new Func1, CloudTask>() { + @Override + public CloudTask call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified task. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param jobId The ID of the job that contains the task. + * @param taskId The ID of the task to get information about. + * @param taskGetOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTask object + */ + public Observable> getWithServiceResponseAsync(String jobId, String taskId, TaskGetOptions taskGetOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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(taskGetOptions); + String select = null; + if (taskGetOptions != null) { + select = taskGetOptions.select(); + } + String expand = null; + if (taskGetOptions != null) { + expand = taskGetOptions.expand(); + } + Integer timeout = null; + if (taskGetOptions != null) { + timeout = taskGetOptions.timeout(); + } + UUID clientRequestId = null; + if (taskGetOptions != null) { + clientRequestId = taskGetOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (taskGetOptions != null) { + returnClientRequestId = taskGetOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (taskGetOptions != null) { + ocpDate = taskGetOptions.ocpDate(); + } + String ifMatch = null; + if (taskGetOptions != null) { + ifMatch = taskGetOptions.ifMatch(); + } + String ifNoneMatch = null; + if (taskGetOptions != null) { + ifNoneMatch = taskGetOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (taskGetOptions != null) { + ifModifiedSince = taskGetOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (taskGetOptions != null) { + ifUnmodifiedSince = taskGetOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.get(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, TaskGetHeaders.class); + } + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobId, String taskId) { + updateWithServiceResponseAsync(jobId, taskId).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to 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 jobId, String taskId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(jobId, taskId), serviceCallback); + } + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable updateAsync(String jobId, String taskId) { + return updateWithServiceResponseAsync(jobId, taskId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String jobId, String taskId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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 TaskConstraints constraints = null; + final TaskUpdateOptions taskUpdateOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + TaskUpdateParameter taskUpdateParameter = new TaskUpdateParameter(); + taskUpdateParameter.withConstraints(null); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.update(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, taskUpdateParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @param constraints Constraints that apply to this task. If omitted, the task is given the default constraints. For multi-instance tasks, updating the retention time applies only to the primary task and not subtasks. + * @param taskUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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 jobId, String taskId, TaskConstraints constraints, TaskUpdateOptions taskUpdateOptions) { + updateWithServiceResponseAsync(jobId, taskId, constraints, taskUpdateOptions).toBlocking().single().body(); + } + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @param constraints Constraints that apply to this task. If omitted, the task is given the default constraints. For multi-instance tasks, updating the retention time applies only to the primary task and not subtasks. + * @param taskUpdateOptions Additional parameters for the operation + * @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 jobId, String taskId, TaskConstraints constraints, TaskUpdateOptions taskUpdateOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(jobId, taskId, constraints, taskUpdateOptions), serviceCallback); + } + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @param constraints Constraints that apply to this task. If omitted, the task is given the default constraints. For multi-instance tasks, updating the retention time applies only to the primary task and not subtasks. + * @param taskUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable updateAsync(String jobId, String taskId, TaskConstraints constraints, TaskUpdateOptions taskUpdateOptions) { + return updateWithServiceResponseAsync(jobId, taskId, constraints, taskUpdateOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of the specified task. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to update. + * @param constraints Constraints that apply to this task. If omitted, the task is given the default constraints. For multi-instance tasks, updating the retention time applies only to the primary task and not subtasks. + * @param taskUpdateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String jobId, String taskId, TaskConstraints constraints, TaskUpdateOptions taskUpdateOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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(constraints); + Validator.validate(taskUpdateOptions); + Integer timeout = null; + if (taskUpdateOptions != null) { + timeout = taskUpdateOptions.timeout(); + } + UUID clientRequestId = null; + if (taskUpdateOptions != null) { + clientRequestId = taskUpdateOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (taskUpdateOptions != null) { + returnClientRequestId = taskUpdateOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (taskUpdateOptions != null) { + ocpDate = taskUpdateOptions.ocpDate(); + } + String ifMatch = null; + if (taskUpdateOptions != null) { + ifMatch = taskUpdateOptions.ifMatch(); + } + String ifNoneMatch = null; + if (taskUpdateOptions != null) { + ifNoneMatch = taskUpdateOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (taskUpdateOptions != null) { + ifModifiedSince = taskUpdateOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (taskUpdateOptions != null) { + ifUnmodifiedSince = taskUpdateOptions.ifUnmodifiedSince(); + } + TaskUpdateParameter taskUpdateParameter = new TaskUpdateParameter(); + taskUpdateParameter.withConstraints(constraints); + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.update(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, taskUpdateParameter, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders updateDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, TaskUpdateHeaders.class); + } + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudTaskListSubtasksResult object if successful. + */ + public CloudTaskListSubtasksResult listSubtasks(String jobId, String taskId) { + return listSubtasksWithServiceResponseAsync(jobId, taskId).toBlocking().single().body(); + } + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @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 listSubtasksAsync(String jobId, String taskId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(listSubtasksWithServiceResponseAsync(jobId, taskId), serviceCallback); + } + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTaskListSubtasksResult object + */ + public Observable listSubtasksAsync(String jobId, String taskId) { + return listSubtasksWithServiceResponseAsync(jobId, taskId).map(new Func1, CloudTaskListSubtasksResult>() { + @Override + public CloudTaskListSubtasksResult call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTaskListSubtasksResult object + */ + public Observable> listSubtasksWithServiceResponseAsync(String jobId, String taskId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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 TaskListSubtasksOptions taskListSubtasksOptions = null; + String select = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listSubtasks(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), select, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = listSubtasksDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @param taskListSubtasksOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CloudTaskListSubtasksResult object if successful. + */ + public CloudTaskListSubtasksResult listSubtasks(String jobId, String taskId, TaskListSubtasksOptions taskListSubtasksOptions) { + return listSubtasksWithServiceResponseAsync(jobId, taskId, taskListSubtasksOptions).toBlocking().single().body(); + } + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @param taskListSubtasksOptions Additional parameters for the operation + * @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 listSubtasksAsync(String jobId, String taskId, TaskListSubtasksOptions taskListSubtasksOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(listSubtasksWithServiceResponseAsync(jobId, taskId, taskListSubtasksOptions), serviceCallback); + } + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @param taskListSubtasksOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTaskListSubtasksResult object + */ + public Observable listSubtasksAsync(String jobId, String taskId, TaskListSubtasksOptions taskListSubtasksOptions) { + return listSubtasksWithServiceResponseAsync(jobId, taskId, taskListSubtasksOptions).map(new Func1, CloudTaskListSubtasksResult>() { + @Override + public CloudTaskListSubtasksResult call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Lists all of the subtasks that are associated with the specified multi-instance task. + * If the task is not a multi-instance task then this returns an empty collection. + * + * @param jobId The ID of the job. + * @param taskId The ID of the task. + * @param taskListSubtasksOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CloudTaskListSubtasksResult object + */ + public Observable> listSubtasksWithServiceResponseAsync(String jobId, String taskId, TaskListSubtasksOptions taskListSubtasksOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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(taskListSubtasksOptions); + String select = null; + if (taskListSubtasksOptions != null) { + select = taskListSubtasksOptions.select(); + } + Integer timeout = null; + if (taskListSubtasksOptions != null) { + timeout = taskListSubtasksOptions.timeout(); + } + UUID clientRequestId = null; + if (taskListSubtasksOptions != null) { + clientRequestId = taskListSubtasksOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (taskListSubtasksOptions != null) { + returnClientRequestId = taskListSubtasksOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (taskListSubtasksOptions != null) { + ocpDate = taskListSubtasksOptions.ocpDate(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + return service.listSubtasks(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), select, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = listSubtasksDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders listSubtasksDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, TaskListSubtasksHeaders.class); + } + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void terminate(String jobId, String taskId) { + terminateWithServiceResponseAsync(jobId, taskId).toBlocking().single().body(); + } + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @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 terminateAsync(String jobId, String taskId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(terminateWithServiceResponseAsync(jobId, taskId), serviceCallback); + } + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable terminateAsync(String jobId, String taskId) { + return terminateWithServiceResponseAsync(jobId, taskId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> terminateWithServiceResponseAsync(String jobId, String taskId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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 TaskTerminateOptions taskTerminateOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.terminate(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = terminateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @param taskTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void terminate(String jobId, String taskId, TaskTerminateOptions taskTerminateOptions) { + terminateWithServiceResponseAsync(jobId, taskId, taskTerminateOptions).toBlocking().single().body(); + } + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @param taskTerminateOptions Additional parameters for the operation + * @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 terminateAsync(String jobId, String taskId, TaskTerminateOptions taskTerminateOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(terminateWithServiceResponseAsync(jobId, taskId, taskTerminateOptions), serviceCallback); + } + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @param taskTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable terminateAsync(String jobId, String taskId, TaskTerminateOptions taskTerminateOptions) { + return terminateWithServiceResponseAsync(jobId, taskId, taskTerminateOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Terminates the specified task. + * When the task has been terminated, it moves to the completed state. For multi-instance tasks, the terminate task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background. + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to terminate. + * @param taskTerminateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> terminateWithServiceResponseAsync(String jobId, String taskId, TaskTerminateOptions taskTerminateOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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(taskTerminateOptions); + Integer timeout = null; + if (taskTerminateOptions != null) { + timeout = taskTerminateOptions.timeout(); + } + UUID clientRequestId = null; + if (taskTerminateOptions != null) { + clientRequestId = taskTerminateOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (taskTerminateOptions != null) { + returnClientRequestId = taskTerminateOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (taskTerminateOptions != null) { + ocpDate = taskTerminateOptions.ocpDate(); + } + String ifMatch = null; + if (taskTerminateOptions != null) { + ifMatch = taskTerminateOptions.ifMatch(); + } + String ifNoneMatch = null; + if (taskTerminateOptions != null) { + ifNoneMatch = taskTerminateOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (taskTerminateOptions != null) { + ifModifiedSince = taskTerminateOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (taskTerminateOptions != null) { + ifUnmodifiedSince = taskTerminateOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.terminate(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = terminateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders terminateDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, TaskTerminateHeaders.class); + } + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void reactivate(String jobId, String taskId) { + reactivateWithServiceResponseAsync(jobId, taskId).toBlocking().single().body(); + } + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @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 reactivateAsync(String jobId, String taskId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(reactivateWithServiceResponseAsync(jobId, taskId), serviceCallback); + } + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable reactivateAsync(String jobId, String taskId) { + return reactivateWithServiceResponseAsync(jobId, taskId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> reactivateWithServiceResponseAsync(String jobId, String taskId) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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 TaskReactivateOptions taskReactivateOptions = null; + Integer timeout = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + String ifMatch = null; + String ifNoneMatch = null; + DateTime ifModifiedSince = null; + DateTime ifUnmodifiedSince = null; + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.reactivate(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = reactivateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @param taskReactivateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void reactivate(String jobId, String taskId, TaskReactivateOptions taskReactivateOptions) { + reactivateWithServiceResponseAsync(jobId, taskId, taskReactivateOptions).toBlocking().single().body(); + } + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @param taskReactivateOptions Additional parameters for the operation + * @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 reactivateAsync(String jobId, String taskId, TaskReactivateOptions taskReactivateOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(reactivateWithServiceResponseAsync(jobId, taskId, taskReactivateOptions), serviceCallback); + } + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @param taskReactivateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable reactivateAsync(String jobId, String taskId, TaskReactivateOptions taskReactivateOptions) { + return reactivateWithServiceResponseAsync(jobId, taskId, taskReactivateOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Reactivates a task, allowing it to run again even if its retry count has been exhausted. + * Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting). + * + * @param jobId The ID of the job containing the task. + * @param taskId The ID of the task to reactivate. + * @param taskReactivateOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> reactivateWithServiceResponseAsync(String jobId, String taskId, TaskReactivateOptions taskReactivateOptions) { + if (this.client.batchUrl() == null) { + throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null."); + } + if (jobId == null) { + throw new IllegalArgumentException("Parameter jobId is required and cannot be null."); + } + if (taskId == null) { + throw new IllegalArgumentException("Parameter taskId 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(taskReactivateOptions); + Integer timeout = null; + if (taskReactivateOptions != null) { + timeout = taskReactivateOptions.timeout(); + } + UUID clientRequestId = null; + if (taskReactivateOptions != null) { + clientRequestId = taskReactivateOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (taskReactivateOptions != null) { + returnClientRequestId = taskReactivateOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (taskReactivateOptions != null) { + ocpDate = taskReactivateOptions.ocpDate(); + } + String ifMatch = null; + if (taskReactivateOptions != null) { + ifMatch = taskReactivateOptions.ifMatch(); + } + String ifNoneMatch = null; + if (taskReactivateOptions != null) { + ifNoneMatch = taskReactivateOptions.ifNoneMatch(); + } + DateTime ifModifiedSince = null; + if (taskReactivateOptions != null) { + ifModifiedSince = taskReactivateOptions.ifModifiedSince(); + } + DateTime ifUnmodifiedSince = null; + if (taskReactivateOptions != null) { + ifUnmodifiedSince = taskReactivateOptions.ifUnmodifiedSince(); + } + String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl()); + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + DateTimeRfc1123 ifModifiedSinceConverted = null; + if (ifModifiedSince != null) { + ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); + } + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + if (ifUnmodifiedSince != null) { + ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); + } + return service.reactivate(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = reactivateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders reactivateDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, TaskReactivateHeaders.class); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudTask> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponseWithHeaders, TaskListHeaders> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @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.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, null); + } + }, + serviceCallback); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @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<CloudTask> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1, TaskListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, TaskListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @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<CloudTask> object + */ + public Observable, TaskListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1, TaskListHeaders>, Observable, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(ServiceResponseWithHeaders, TaskListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null)); + } + }); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudTask> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, TaskListHeaders>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final TaskListNextOptions taskListNextOptions = null; + UUID clientRequestId = null; + Boolean returnClientRequestId = null; + DateTime ocpDate = null; + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, TaskListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, TaskListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param taskListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws BatchErrorException 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<CloudTask> object if successful. + */ + public PagedList listNext(final String nextPageLink, final TaskListNextOptions taskListNextOptions) { + ServiceResponseWithHeaders, TaskListHeaders> response = listNextSinglePageAsync(nextPageLink, taskListNextOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, taskListNextOptions).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param taskListNextOptions Additional parameters for the 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 TaskListNextOptions taskListNextOptions, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromHeaderPageResponse( + listNextSinglePageAsync(nextPageLink, taskListNextOptions), + new Func1, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink, taskListNextOptions); + } + }, + serviceCallback); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param taskListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + public Observable> listNextAsync(final String nextPageLink, final TaskListNextOptions taskListNextOptions) { + return listNextWithServiceResponseAsync(nextPageLink, taskListNextOptions) + .map(new Func1, TaskListHeaders>, Page>() { + @Override + public Page call(ServiceResponseWithHeaders, TaskListHeaders> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param taskListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CloudTask> object + */ + public Observable, TaskListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final TaskListNextOptions taskListNextOptions) { + return listNextSinglePageAsync(nextPageLink, taskListNextOptions) + .concatMap(new Func1, TaskListHeaders>, Observable, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(ServiceResponseWithHeaders, TaskListHeaders> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, taskListNextOptions)); + } + }); + } + + /** + * Lists all of the tasks that are associated with the specified job. + * For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. + * + ServiceResponseWithHeaders, TaskListHeaders> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponseWithHeaders, TaskListHeaders> * @param taskListNextOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CloudTask> object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public Observable, TaskListHeaders>> listNextSinglePageAsync(final String nextPageLink, final TaskListNextOptions taskListNextOptions) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(taskListNextOptions); + UUID clientRequestId = null; + if (taskListNextOptions != null) { + clientRequestId = taskListNextOptions.clientRequestId(); + } + Boolean returnClientRequestId = null; + if (taskListNextOptions != null) { + returnClientRequestId = taskListNextOptions.returnClientRequestId(); + } + DateTime ocpDate = null; + if (taskListNextOptions != null) { + ocpDate = taskListNextOptions.ocpDate(); + } + DateTimeRfc1123 ocpDateConverted = null; + if (ocpDate != null) { + ocpDateConverted = new DateTimeRfc1123(ocpDate); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()) + .flatMap(new Func1, Observable, TaskListHeaders>>>() { + @Override + public Observable, TaskListHeaders>> call(Response response) { + try { + ServiceResponseWithHeaders, TaskListHeaders> result = listNextDelegate(response); + return Observable.just(new ServiceResponseWithHeaders, TaskListHeaders>(result.body(), result.headers(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders, TaskListHeaders> listNextDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(BatchErrorException.class) + .buildWithHeaders(response, TaskListHeaders.class); + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/package-info.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/package-info.java new file mode 100644 index 000000000000..f627d167a40c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +/** + * This package contains the implementation classes for BatchServiceClient. + * A client for issuing REST requests to the Azure Batch service. + */ +package com.microsoft.azure.batch.protocol.implementation; diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccessScope.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccessScope.java new file mode 100644 index 000000000000..bc1afcf90574 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccessScope.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AccessScope. + */ +public enum AccessScope { + /** Grants access to perform all operations on the job containing the task. */ + JOB("job"); + + /** The actual serialized value for a AccessScope instance. */ + private String value; + + AccessScope(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AccessScope instance. + * + * @param value the serialized value to parse. + * @return the parsed AccessScope object, or null if unable to parse. + */ + @JsonCreator + public static AccessScope fromString(String value) { + AccessScope[] items = AccessScope.values(); + for (AccessScope item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListNodeAgentSkusHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListNodeAgentSkusHeaders.java new file mode 100644 index 000000000000..2394599b71aa --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListNodeAgentSkusHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for ListNodeAgentSkus operation. + */ +public class AccountListNodeAgentSkusHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the AccountListNodeAgentSkusHeaders object itself. + */ + public AccountListNodeAgentSkusHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the AccountListNodeAgentSkusHeaders object itself. + */ + public AccountListNodeAgentSkusHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the AccountListNodeAgentSkusHeaders object itself. + */ + public AccountListNodeAgentSkusHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the AccountListNodeAgentSkusHeaders object itself. + */ + public AccountListNodeAgentSkusHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListNodeAgentSkusNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListNodeAgentSkusNextOptions.java new file mode 100644 index 000000000000..f1e36bf5aa8f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListNodeAgentSkusNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listNodeAgentSkusNext operation. + */ +public class AccountListNodeAgentSkusNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the AccountListNodeAgentSkusNextOptions object itself. + */ + public AccountListNodeAgentSkusNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the AccountListNodeAgentSkusNextOptions object itself. + */ + public AccountListNodeAgentSkusNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the AccountListNodeAgentSkusNextOptions object itself. + */ + public AccountListNodeAgentSkusNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListNodeAgentSkusOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListNodeAgentSkusOptions.java new file mode 100644 index 000000000000..e17b536b678c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListNodeAgentSkusOptions.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listNodeAgentSkus operation. + */ +public class AccountListNodeAgentSkusOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-node-agent-skus. + */ + @JsonProperty(value = "") + private String filter; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * results will be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-node-agent-skus. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-node-agent-skus. + * + * @param filter the filter value to set + * @return the AccountListNodeAgentSkusOptions object itself. + */ + public AccountListNodeAgentSkusOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 results will be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 results will be returned. + * + * @param maxResults the maxResults value to set + * @return the AccountListNodeAgentSkusOptions object itself. + */ + public AccountListNodeAgentSkusOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the AccountListNodeAgentSkusOptions object itself. + */ + public AccountListNodeAgentSkusOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the AccountListNodeAgentSkusOptions object itself. + */ + public AccountListNodeAgentSkusOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the AccountListNodeAgentSkusOptions object itself. + */ + public AccountListNodeAgentSkusOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the AccountListNodeAgentSkusOptions object itself. + */ + public AccountListNodeAgentSkusOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListPoolNodeCountsHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListPoolNodeCountsHeaders.java new file mode 100644 index 000000000000..0388fdf16d08 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListPoolNodeCountsHeaders.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for ListPoolNodeCounts operation. + */ +public class AccountListPoolNodeCountsHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the AccountListPoolNodeCountsHeaders object itself. + */ + public AccountListPoolNodeCountsHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the AccountListPoolNodeCountsHeaders object itself. + */ + public AccountListPoolNodeCountsHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListPoolNodeCountsNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListPoolNodeCountsNextOptions.java new file mode 100644 index 000000000000..14dacb78d159 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListPoolNodeCountsNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listPoolNodeCountsNext operation. + */ +public class AccountListPoolNodeCountsNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the AccountListPoolNodeCountsNextOptions object itself. + */ + public AccountListPoolNodeCountsNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the AccountListPoolNodeCountsNextOptions object itself. + */ + public AccountListPoolNodeCountsNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the AccountListPoolNodeCountsNextOptions object itself. + */ + public AccountListPoolNodeCountsNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListPoolNodeCountsOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListPoolNodeCountsOptions.java new file mode 100644 index 000000000000..dcef4dd21eb9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AccountListPoolNodeCountsOptions.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listPoolNodeCounts operation. + */ +public class AccountListPoolNodeCountsOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch. + */ + @JsonProperty(value = "") + private String filter; + + /** + * The maximum number of items to return in the response. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch. + * + * @param filter the filter value to set + * @return the AccountListPoolNodeCountsOptions object itself. + */ + public AccountListPoolNodeCountsOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the maximum number of items to return in the response. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. + * + * @param maxResults the maxResults value to set + * @return the AccountListPoolNodeCountsOptions object itself. + */ + public AccountListPoolNodeCountsOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the AccountListPoolNodeCountsOptions object itself. + */ + public AccountListPoolNodeCountsOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the AccountListPoolNodeCountsOptions object itself. + */ + public AccountListPoolNodeCountsOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the AccountListPoolNodeCountsOptions object itself. + */ + public AccountListPoolNodeCountsOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the AccountListPoolNodeCountsOptions object itself. + */ + public AccountListPoolNodeCountsOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AffinityInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AffinityInformation.java new file mode 100644 index 000000000000..f284004a560d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AffinityInformation.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A locality hint that can be used by the Batch service to select a compute + * node on which to start a task. + */ +public class AffinityInformation { + /** + * An opaque string representing the location of a compute node or a task + * that has run previously. + * You can pass the affinityId of a compute node to indicate that this task + * needs to run on that compute node. Note that this is just a soft + * affinity. If the target node is busy or unavailable at the time the task + * is scheduled, then the task will be scheduled elsewhere. + */ + @JsonProperty(value = "affinityId", required = true) + private String affinityId; + + /** + * Get you can pass the affinityId of a compute node to indicate that this task needs to run on that compute node. Note that this is just a soft affinity. If the target node is busy or unavailable at the time the task is scheduled, then the task will be scheduled elsewhere. + * + * @return the affinityId value + */ + public String affinityId() { + return this.affinityId; + } + + /** + * Set you can pass the affinityId of a compute node to indicate that this task needs to run on that compute node. Note that this is just a soft affinity. If the target node is busy or unavailable at the time the task is scheduled, then the task will be scheduled elsewhere. + * + * @param affinityId the affinityId value to set + * @return the AffinityInformation object itself. + */ + public AffinityInformation withAffinityId(String affinityId) { + this.affinityId = affinityId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AllocationState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AllocationState.java new file mode 100644 index 000000000000..ee6af5cc63cf --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AllocationState.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AllocationState. + */ +public enum AllocationState { + /** The pool is not resizing. There are no changes to the number of nodes in the pool in progress. A pool enters this state when it is created and when no operations are being performed on the pool to change the number of nodes. */ + STEADY("steady"), + + /** The pool is resizing; that is, compute nodes are being added to or removed from the pool. */ + RESIZING("resizing"), + + /** The pool was resizing, but the user has requested that the resize be stopped, but the stop request has not yet been completed. */ + STOPPING("stopping"); + + /** The actual serialized value for a AllocationState instance. */ + private String value; + + AllocationState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AllocationState instance. + * + * @param value the serialized value to parse. + * @return the parsed AllocationState object, or null if unable to parse. + */ + @JsonCreator + public static AllocationState fromString(String value) { + AllocationState[] items = AllocationState.values(); + for (AllocationState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationGetHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationGetHeaders.java new file mode 100644 index 000000000000..f73fed53631c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationGetHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApplicationGetHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ApplicationGetHeaders object itself. + */ + public ApplicationGetHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ApplicationGetHeaders object itself. + */ + public ApplicationGetHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ApplicationGetHeaders object itself. + */ + public ApplicationGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ApplicationGetHeaders object itself. + */ + public ApplicationGetHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationGetOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationGetOptions.java new file mode 100644 index 000000000000..531c1f458cc9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationGetOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for get operation. + */ +public class ApplicationGetOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ApplicationGetOptions object itself. + */ + public ApplicationGetOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ApplicationGetOptions object itself. + */ + public ApplicationGetOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ApplicationGetOptions object itself. + */ + public ApplicationGetOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ApplicationGetOptions object itself. + */ + public ApplicationGetOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationListHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationListHeaders.java new file mode 100644 index 000000000000..baab866d6382 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationListHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for List operation. + */ +public class ApplicationListHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ApplicationListHeaders object itself. + */ + public ApplicationListHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ApplicationListHeaders object itself. + */ + public ApplicationListHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ApplicationListHeaders object itself. + */ + public ApplicationListHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ApplicationListHeaders object itself. + */ + public ApplicationListHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationListNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationListNextOptions.java new file mode 100644 index 000000000000..2451e055db96 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationListNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listNext operation. + */ +public class ApplicationListNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ApplicationListNextOptions object itself. + */ + public ApplicationListNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ApplicationListNextOptions object itself. + */ + public ApplicationListNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ApplicationListNextOptions object itself. + */ + public ApplicationListNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationListOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationListOptions.java new file mode 100644 index 000000000000..3359606cf051 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationListOptions.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for list operation. + */ +public class ApplicationListOptions { + /** + * The maximum number of items to return in the response. A maximum of 1000 + * applications can be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 applications can be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 applications can be returned. + * + * @param maxResults the maxResults value to set + * @return the ApplicationListOptions object itself. + */ + public ApplicationListOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ApplicationListOptions object itself. + */ + public ApplicationListOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ApplicationListOptions object itself. + */ + public ApplicationListOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ApplicationListOptions object itself. + */ + public ApplicationListOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ApplicationListOptions object itself. + */ + public ApplicationListOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationPackageReference.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationPackageReference.java new file mode 100644 index 000000000000..42bb787bac80 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationPackageReference.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A reference to an application package to be deployed to compute nodes. + */ +public class ApplicationPackageReference { + /** + * The ID of the application to deploy. + */ + @JsonProperty(value = "applicationId", required = true) + private String applicationId; + + /** + * The version of the application to deploy. If omitted, the default + * version is deployed. + * If this is omitted on a pool, and no default version is specified for + * this application, the request fails with the error code + * InvalidApplicationPackageReferences and HTTP status code 409. If this is + * omitted on a task, and no default version is specified for this + * application, the task fails with a pre-processing error. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the applicationId value. + * + * @return the applicationId value + */ + public String applicationId() { + return this.applicationId; + } + + /** + * Set the applicationId value. + * + * @param applicationId the applicationId value to set + * @return the ApplicationPackageReference object itself. + */ + public ApplicationPackageReference withApplicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get if this is omitted on a pool, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences and HTTP status code 409. If this is omitted on a task, and no default version is specified for this application, the task fails with a pre-processing error. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set if this is omitted on a pool, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences and HTTP status code 409. If this is omitted on a task, and no default version is specified for this application, the task fails with a pre-processing error. + * + * @param version the version value to set + * @return the ApplicationPackageReference object itself. + */ + public ApplicationPackageReference withVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationSummary.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationSummary.java new file mode 100644 index 000000000000..528cf41c65e9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ApplicationSummary.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about an application in an Azure Batch account. + */ +public class ApplicationSummary { + /** + * A string that uniquely identifies the application within the account. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The display name for the application. + */ + @JsonProperty(value = "displayName", required = true) + private String displayName; + + /** + * The list of available versions of the application. + */ + @JsonProperty(value = "versions", required = true) + private List versions; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the ApplicationSummary object itself. + */ + public ApplicationSummary withId(String id) { + this.id = id; + return this; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the ApplicationSummary object itself. + */ + public ApplicationSummary withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the versions value. + * + * @return the versions value + */ + public List versions() { + return this.versions; + } + + /** + * Set the versions value. + * + * @param versions the versions value to set + * @return the ApplicationSummary object itself. + */ + public ApplicationSummary withVersions(List versions) { + this.versions = versions; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AuthenticationTokenSettings.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AuthenticationTokenSettings.java new file mode 100644 index 000000000000..e4422ee9e254 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AuthenticationTokenSettings.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The settings for an authentication token that the task can use to perform + * Batch service operations. + */ +public class AuthenticationTokenSettings { + /** + * The Batch resources to which the token grants access. + * The authentication token grants access to a limited set of Batch service + * operations. Currently the only supported value for the access property + * is 'job', which grants access to all operations related to the job which + * contains the task. + */ + @JsonProperty(value = "access") + private List access; + + /** + * Get the authentication token grants access to a limited set of Batch service operations. Currently the only supported value for the access property is 'job', which grants access to all operations related to the job which contains the task. + * + * @return the access value + */ + public List access() { + return this.access; + } + + /** + * Set the authentication token grants access to a limited set of Batch service operations. Currently the only supported value for the access property is 'job', which grants access to all operations related to the job which contains the task. + * + * @param access the access value to set + * @return the AuthenticationTokenSettings object itself. + */ + public AuthenticationTokenSettings withAccess(List access) { + this.access = access; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoPoolSpecification.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoPoolSpecification.java new file mode 100644 index 000000000000..acee2c4f9cd8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoPoolSpecification.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies characteristics for a temporary 'auto pool'. The Batch service + * will create this auto pool when the job is submitted. + */ +public class AutoPoolSpecification { + /** + * A prefix to be added to the unique identifier when a pool is + * automatically created. + * The Batch service assigns each auto pool a unique identifier on + * creation. To distinguish between pools created for different purposes, + * you can specify this element to add a prefix to the ID that is assigned. + * The prefix can be up to 20 characters long. + */ + @JsonProperty(value = "autoPoolIdPrefix") + private String autoPoolIdPrefix; + + /** + * The minimum lifetime of created auto pools, and how multiple jobs on a + * schedule are assigned to pools. + * Possible values include: 'jobSchedule', 'job'. + */ + @JsonProperty(value = "poolLifetimeOption", required = true) + private PoolLifetimeOption poolLifetimeOption; + + /** + * Whether to keep an auto pool alive after its lifetime expires. + * If false, the Batch service deletes the pool once its lifetime (as + * determined by the poolLifetimeOption setting) expires; that is, when the + * job or job schedule completes. If true, the Batch service does not + * delete the pool automatically. It is up to the user to delete auto pools + * created with this option. + */ + @JsonProperty(value = "keepAlive") + private Boolean keepAlive; + + /** + * The pool specification for the auto pool. + */ + @JsonProperty(value = "pool") + private PoolSpecification pool; + + /** + * Get the Batch service assigns each auto pool a unique identifier on creation. To distinguish between pools created for different purposes, you can specify this element to add a prefix to the ID that is assigned. The prefix can be up to 20 characters long. + * + * @return the autoPoolIdPrefix value + */ + public String autoPoolIdPrefix() { + return this.autoPoolIdPrefix; + } + + /** + * Set the Batch service assigns each auto pool a unique identifier on creation. To distinguish between pools created for different purposes, you can specify this element to add a prefix to the ID that is assigned. The prefix can be up to 20 characters long. + * + * @param autoPoolIdPrefix the autoPoolIdPrefix value to set + * @return the AutoPoolSpecification object itself. + */ + public AutoPoolSpecification withAutoPoolIdPrefix(String autoPoolIdPrefix) { + this.autoPoolIdPrefix = autoPoolIdPrefix; + return this; + } + + /** + * Get possible values include: 'jobSchedule', 'job'. + * + * @return the poolLifetimeOption value + */ + public PoolLifetimeOption poolLifetimeOption() { + return this.poolLifetimeOption; + } + + /** + * Set possible values include: 'jobSchedule', 'job'. + * + * @param poolLifetimeOption the poolLifetimeOption value to set + * @return the AutoPoolSpecification object itself. + */ + public AutoPoolSpecification withPoolLifetimeOption(PoolLifetimeOption poolLifetimeOption) { + this.poolLifetimeOption = poolLifetimeOption; + return this; + } + + /** + * Get if false, the Batch service deletes the pool once its lifetime (as determined by the poolLifetimeOption setting) expires; that is, when the job or job schedule completes. If true, the Batch service does not delete the pool automatically. It is up to the user to delete auto pools created with this option. + * + * @return the keepAlive value + */ + public Boolean keepAlive() { + return this.keepAlive; + } + + /** + * Set if false, the Batch service deletes the pool once its lifetime (as determined by the poolLifetimeOption setting) expires; that is, when the job or job schedule completes. If true, the Batch service does not delete the pool automatically. It is up to the user to delete auto pools created with this option. + * + * @param keepAlive the keepAlive value to set + * @return the AutoPoolSpecification object itself. + */ + public AutoPoolSpecification withKeepAlive(Boolean keepAlive) { + this.keepAlive = keepAlive; + return this; + } + + /** + * Get the pool value. + * + * @return the pool value + */ + public PoolSpecification pool() { + return this.pool; + } + + /** + * Set the pool value. + * + * @param pool the pool value to set + * @return the AutoPoolSpecification object itself. + */ + public AutoPoolSpecification withPool(PoolSpecification pool) { + this.pool = pool; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoScaleRun.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoScaleRun.java new file mode 100644 index 000000000000..648ba2eb26d9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoScaleRun.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The results and errors from an execution of a pool autoscale formula. + */ +public class AutoScaleRun { + /** + * The time at which the autoscale formula was last evaluated. + */ + @JsonProperty(value = "timestamp", required = true) + private DateTime timestamp; + + /** + * The final values of all variables used in the evaluation of the + * autoscale formula. + * Each variable value is returned in the form $variable=value, and + * variables are separated by semicolons. + */ + @JsonProperty(value = "results") + private String results; + + /** + * Details of the error encountered evaluating the autoscale formula on the + * pool, if the evaluation was unsuccessful. + */ + @JsonProperty(value = "error") + private AutoScaleRunError error; + + /** + * Get the timestamp value. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp value. + * + * @param timestamp the timestamp value to set + * @return the AutoScaleRun object itself. + */ + public AutoScaleRun withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get each variable value is returned in the form $variable=value, and variables are separated by semicolons. + * + * @return the results value + */ + public String results() { + return this.results; + } + + /** + * Set each variable value is returned in the form $variable=value, and variables are separated by semicolons. + * + * @param results the results value to set + * @return the AutoScaleRun object itself. + */ + public AutoScaleRun withResults(String results) { + this.results = results; + return this; + } + + /** + * Get the error value. + * + * @return the error value + */ + public AutoScaleRunError error() { + return this.error; + } + + /** + * Set the error value. + * + * @param error the error value to set + * @return the AutoScaleRun object itself. + */ + public AutoScaleRun withError(AutoScaleRunError error) { + this.error = error; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoScaleRunError.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoScaleRunError.java new file mode 100644 index 000000000000..d2d2ddfa67c5 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoScaleRunError.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error that occurred when executing or evaluating a pool autoscale + * formula. + */ +public class AutoScaleRunError { + /** + * An identifier for the autoscale error. Codes are invariant and are + * intended to be consumed programmatically. + */ + @JsonProperty(value = "code") + private String code; + + /** + * A message describing the autoscale error, intended to be suitable for + * display in a user interface. + */ + @JsonProperty(value = "message") + private String message; + + /** + * A list of additional error details related to the autoscale error. + */ + @JsonProperty(value = "values") + private List values; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the AutoScaleRunError object itself. + */ + public AutoScaleRunError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the AutoScaleRunError object itself. + */ + public AutoScaleRunError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the values value. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set the values value. + * + * @param values the values value to set + * @return the AutoScaleRunError object itself. + */ + public AutoScaleRunError withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoUserScope.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoUserScope.java new file mode 100644 index 000000000000..599ec95c717b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoUserScope.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AutoUserScope. + */ +public enum AutoUserScope { + /** Specifies that the service should create a new user for the task. */ + TASK("task"), + + /** Specifies that the task runs as the common auto user account which is created on every node in a pool. */ + POOL("pool"); + + /** The actual serialized value for a AutoUserScope instance. */ + private String value; + + AutoUserScope(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutoUserScope instance. + * + * @param value the serialized value to parse. + * @return the parsed AutoUserScope object, or null if unable to parse. + */ + @JsonCreator + public static AutoUserScope fromString(String value) { + AutoUserScope[] items = AutoUserScope.values(); + for (AutoUserScope item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoUserSpecification.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoUserSpecification.java new file mode 100644 index 000000000000..8f6fef2ac012 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/AutoUserSpecification.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the parameters for the auto user that runs a task on the Batch + * service. + */ +public class AutoUserSpecification { + /** + * The scope for the auto user. + * The default value is task. Possible values include: 'task', 'pool'. + */ + @JsonProperty(value = "scope") + private AutoUserScope scope; + + /** + * The elevation level of the auto user. + * The default value is nonAdmin. Possible values include: 'nonAdmin', + * 'admin'. + */ + @JsonProperty(value = "elevationLevel") + private ElevationLevel elevationLevel; + + /** + * Get the default value is task. Possible values include: 'task', 'pool'. + * + * @return the scope value + */ + public AutoUserScope scope() { + return this.scope; + } + + /** + * Set the default value is task. Possible values include: 'task', 'pool'. + * + * @param scope the scope value to set + * @return the AutoUserSpecification object itself. + */ + public AutoUserSpecification withScope(AutoUserScope scope) { + this.scope = scope; + return this; + } + + /** + * Get the default value is nonAdmin. Possible values include: 'nonAdmin', 'admin'. + * + * @return the elevationLevel value + */ + public ElevationLevel elevationLevel() { + return this.elevationLevel; + } + + /** + * Set the default value is nonAdmin. Possible values include: 'nonAdmin', 'admin'. + * + * @param elevationLevel the elevationLevel value to set + * @return the AutoUserSpecification object itself. + */ + public AutoUserSpecification withElevationLevel(ElevationLevel elevationLevel) { + this.elevationLevel = elevationLevel; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/BatchError.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/BatchError.java new file mode 100644 index 000000000000..9c2b61c2a971 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/BatchError.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error response received from the Azure Batch service. + */ +public class BatchError { + /** + * An identifier for the error. Codes are invariant and are intended to be + * consumed programmatically. + */ + @JsonProperty(value = "code") + private String code; + + /** + * A message describing the error, intended to be suitable for display in a + * user interface. + */ + @JsonProperty(value = "message") + private ErrorMessage message; + + /** + * A collection of key-value pairs containing additional details about the + * error. + */ + @JsonProperty(value = "values") + private List values; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the BatchError object itself. + */ + public BatchError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public ErrorMessage message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the BatchError object itself. + */ + public BatchError withMessage(ErrorMessage message) { + this.message = message; + return this; + } + + /** + * Get the values value. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set the values value. + * + * @param values the values value to set + * @return the BatchError object itself. + */ + public BatchError withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/BatchErrorDetail.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/BatchErrorDetail.java new file mode 100644 index 000000000000..ca4cc7ca9ba8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/BatchErrorDetail.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An item of additional information included in an Azure Batch error response. + */ +public class BatchErrorDetail { + /** + * An identifier specifying the meaning of the Value property. + */ + @JsonProperty(value = "key") + private String key; + + /** + * The additional information included with the error response. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the key value. + * + * @return the key value + */ + public String key() { + return this.key; + } + + /** + * Set the key value. + * + * @param key the key value to set + * @return the BatchErrorDetail object itself. + */ + public BatchErrorDetail withKey(String key) { + this.key = key; + return this; + } + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the BatchErrorDetail object itself. + */ + public BatchErrorDetail withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/BatchErrorException.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/BatchErrorException.java new file mode 100644 index 000000000000..9e4ad6ca6eb0 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/BatchErrorException.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with BatchError information. + */ +public class BatchErrorException extends RestException { + /** + * Initializes a new instance of the BatchErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public BatchErrorException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the BatchErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public BatchErrorException(final String message, final Response response, final BatchError body) { + super(message, response, body); + } + + @Override + public BatchError body() { + return (BatchError) super.body(); + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CachingType.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CachingType.java new file mode 100644 index 000000000000..3da52347dbbc --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CachingType.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CachingType. + */ +public enum CachingType { + /** The caching mode for the disk is not enabled. */ + NONE("none"), + + /** The caching mode for the disk is read only. */ + READ_ONLY("readonly"), + + /** The caching mode for the disk is read and write. */ + READ_WRITE("readwrite"); + + /** The actual serialized value for a CachingType instance. */ + private String value; + + CachingType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CachingType instance. + * + * @param value the serialized value to parse. + * @return the parsed CachingType object, or null if unable to parse. + */ + @JsonCreator + public static CachingType fromString(String value) { + CachingType[] items = CachingType.values(); + for (CachingType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/Certificate.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/Certificate.java new file mode 100644 index 000000000000..3f99bb8422d9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/Certificate.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A certificate that can be installed on compute nodes and can be used to + * authenticate operations on the machine. + */ +public class Certificate { + /** + * The X.509 thumbprint of the certificate. This is a sequence of up to 40 + * hex digits. + */ + @JsonProperty(value = "thumbprint") + private String thumbprint; + + /** + * The algorithm used to derive the thumbprint. + */ + @JsonProperty(value = "thumbprintAlgorithm") + private String thumbprintAlgorithm; + + /** + * The URL of the certificate. + */ + @JsonProperty(value = "url") + private String url; + + /** + * The current state of the certificate. + * Possible values include: 'active', 'deleting', 'deleteFailed'. + */ + @JsonProperty(value = "state") + private CertificateState state; + + /** + * The time at which the certificate entered its current state. + */ + @JsonProperty(value = "stateTransitionTime") + private DateTime stateTransitionTime; + + /** + * The previous state of the certificate. + * This property is not set if the certificate is in its initial active + * state. Possible values include: 'active', 'deleting', 'deleteFailed'. + */ + @JsonProperty(value = "previousState") + private CertificateState previousState; + + /** + * The time at which the certificate entered its previous state. + * This property is not set if the certificate is in its initial Active + * state. + */ + @JsonProperty(value = "previousStateTransitionTime") + private DateTime previousStateTransitionTime; + + /** + * The public part of the certificate as a base-64 encoded .cer file. + */ + @JsonProperty(value = "publicData") + private String publicData; + + /** + * The error that occurred on the last attempt to delete this certificate. + * This property is set only if the certificate is in the DeleteFailed + * state. + */ + @JsonProperty(value = "deleteCertificateError") + private DeleteCertificateError deleteCertificateError; + + /** + * Get the thumbprint value. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint value. + * + * @param thumbprint the thumbprint value to set + * @return the Certificate object itself. + */ + public Certificate withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the thumbprintAlgorithm value. + * + * @return the thumbprintAlgorithm value + */ + public String thumbprintAlgorithm() { + return this.thumbprintAlgorithm; + } + + /** + * Set the thumbprintAlgorithm value. + * + * @param thumbprintAlgorithm the thumbprintAlgorithm value to set + * @return the Certificate object itself. + */ + public Certificate withThumbprintAlgorithm(String thumbprintAlgorithm) { + this.thumbprintAlgorithm = thumbprintAlgorithm; + return this; + } + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the Certificate object itself. + */ + public Certificate withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get possible values include: 'active', 'deleting', 'deleteFailed'. + * + * @return the state value + */ + public CertificateState state() { + return this.state; + } + + /** + * Set possible values include: 'active', 'deleting', 'deleteFailed'. + * + * @param state the state value to set + * @return the Certificate object itself. + */ + public Certificate withState(CertificateState state) { + this.state = state; + return this; + } + + /** + * Get the stateTransitionTime value. + * + * @return the stateTransitionTime value + */ + public DateTime stateTransitionTime() { + return this.stateTransitionTime; + } + + /** + * Set the stateTransitionTime value. + * + * @param stateTransitionTime the stateTransitionTime value to set + * @return the Certificate object itself. + */ + public Certificate withStateTransitionTime(DateTime stateTransitionTime) { + this.stateTransitionTime = stateTransitionTime; + return this; + } + + /** + * Get this property is not set if the certificate is in its initial active state. Possible values include: 'active', 'deleting', 'deleteFailed'. + * + * @return the previousState value + */ + public CertificateState previousState() { + return this.previousState; + } + + /** + * Set this property is not set if the certificate is in its initial active state. Possible values include: 'active', 'deleting', 'deleteFailed'. + * + * @param previousState the previousState value to set + * @return the Certificate object itself. + */ + public Certificate withPreviousState(CertificateState previousState) { + this.previousState = previousState; + return this; + } + + /** + * Get this property is not set if the certificate is in its initial Active state. + * + * @return the previousStateTransitionTime value + */ + public DateTime previousStateTransitionTime() { + return this.previousStateTransitionTime; + } + + /** + * Set this property is not set if the certificate is in its initial Active state. + * + * @param previousStateTransitionTime the previousStateTransitionTime value to set + * @return the Certificate object itself. + */ + public Certificate withPreviousStateTransitionTime(DateTime previousStateTransitionTime) { + this.previousStateTransitionTime = previousStateTransitionTime; + return this; + } + + /** + * Get the publicData value. + * + * @return the publicData value + */ + public String publicData() { + return this.publicData; + } + + /** + * Set the publicData value. + * + * @param publicData the publicData value to set + * @return the Certificate object itself. + */ + public Certificate withPublicData(String publicData) { + this.publicData = publicData; + return this; + } + + /** + * Get this property is set only if the certificate is in the DeleteFailed state. + * + * @return the deleteCertificateError value + */ + public DeleteCertificateError deleteCertificateError() { + return this.deleteCertificateError; + } + + /** + * Set this property is set only if the certificate is in the DeleteFailed state. + * + * @param deleteCertificateError the deleteCertificateError value to set + * @return the Certificate object itself. + */ + public Certificate withDeleteCertificateError(DeleteCertificateError deleteCertificateError) { + this.deleteCertificateError = deleteCertificateError; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateAddHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateAddHeaders.java new file mode 100644 index 000000000000..8962a7f8bb7a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateAddHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Add operation. + */ +public class CertificateAddHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the CertificateAddHeaders object itself. + */ + public CertificateAddHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the CertificateAddHeaders object itself. + */ + public CertificateAddHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the CertificateAddHeaders object itself. + */ + public CertificateAddHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the CertificateAddHeaders object itself. + */ + public CertificateAddHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the CertificateAddHeaders object itself. + */ + public CertificateAddHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateAddOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateAddOptions.java new file mode 100644 index 000000000000..8ce0f1b7d4cf --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateAddOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for add operation. + */ +public class CertificateAddOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the CertificateAddOptions object itself. + */ + public CertificateAddOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the CertificateAddOptions object itself. + */ + public CertificateAddOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the CertificateAddOptions object itself. + */ + public CertificateAddOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the CertificateAddOptions object itself. + */ + public CertificateAddOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateAddParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateAddParameter.java new file mode 100644 index 000000000000..bed8ab6e3792 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateAddParameter.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A certificate that can be installed on compute nodes and can be used to + * authenticate operations on the machine. + */ +public class CertificateAddParameter { + /** + * The X.509 thumbprint of the certificate. This is a sequence of up to 40 + * hex digits (it may include spaces but these are removed). + */ + @JsonProperty(value = "thumbprint", required = true) + private String thumbprint; + + /** + * The algorithm used to derive the thumbprint. This must be sha1. + */ + @JsonProperty(value = "thumbprintAlgorithm", required = true) + private String thumbprintAlgorithm; + + /** + * The base64-encoded contents of the certificate. The maximum size is + * 10KB. + */ + @JsonProperty(value = "data", required = true) + private String data; + + /** + * The format of the certificate data. + * Possible values include: 'pfx', 'cer'. + */ + @JsonProperty(value = "certificateFormat") + private CertificateFormat certificateFormat; + + /** + * The password to access the certificate's private key. + * This is required if the certificate format is pfx. It should be omitted + * if the certificate format is cer. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get the thumbprint value. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint value. + * + * @param thumbprint the thumbprint value to set + * @return the CertificateAddParameter object itself. + */ + public CertificateAddParameter withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the thumbprintAlgorithm value. + * + * @return the thumbprintAlgorithm value + */ + public String thumbprintAlgorithm() { + return this.thumbprintAlgorithm; + } + + /** + * Set the thumbprintAlgorithm value. + * + * @param thumbprintAlgorithm the thumbprintAlgorithm value to set + * @return the CertificateAddParameter object itself. + */ + public CertificateAddParameter withThumbprintAlgorithm(String thumbprintAlgorithm) { + this.thumbprintAlgorithm = thumbprintAlgorithm; + return this; + } + + /** + * Get the data value. + * + * @return the data value + */ + public String data() { + return this.data; + } + + /** + * Set the data value. + * + * @param data the data value to set + * @return the CertificateAddParameter object itself. + */ + public CertificateAddParameter withData(String data) { + this.data = data; + return this; + } + + /** + * Get possible values include: 'pfx', 'cer'. + * + * @return the certificateFormat value + */ + public CertificateFormat certificateFormat() { + return this.certificateFormat; + } + + /** + * Set possible values include: 'pfx', 'cer'. + * + * @param certificateFormat the certificateFormat value to set + * @return the CertificateAddParameter object itself. + */ + public CertificateAddParameter withCertificateFormat(CertificateFormat certificateFormat) { + this.certificateFormat = certificateFormat; + return this; + } + + /** + * Get this is required if the certificate format is pfx. It should be omitted if the certificate format is cer. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set this is required if the certificate format is pfx. It should be omitted if the certificate format is cer. + * + * @param password the password value to set + * @return the CertificateAddParameter object itself. + */ + public CertificateAddParameter withPassword(String password) { + this.password = password; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateCancelDeletionHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateCancelDeletionHeaders.java new file mode 100644 index 000000000000..aa2ed477bf24 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateCancelDeletionHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CancelDeletion operation. + */ +public class CertificateCancelDeletionHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the CertificateCancelDeletionHeaders object itself. + */ + public CertificateCancelDeletionHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the CertificateCancelDeletionHeaders object itself. + */ + public CertificateCancelDeletionHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the CertificateCancelDeletionHeaders object itself. + */ + public CertificateCancelDeletionHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the CertificateCancelDeletionHeaders object itself. + */ + public CertificateCancelDeletionHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the CertificateCancelDeletionHeaders object itself. + */ + public CertificateCancelDeletionHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateCancelDeletionOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateCancelDeletionOptions.java new file mode 100644 index 000000000000..7b7ff55d67bf --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateCancelDeletionOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for cancelDeletion operation. + */ +public class CertificateCancelDeletionOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the CertificateCancelDeletionOptions object itself. + */ + public CertificateCancelDeletionOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the CertificateCancelDeletionOptions object itself. + */ + public CertificateCancelDeletionOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the CertificateCancelDeletionOptions object itself. + */ + public CertificateCancelDeletionOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the CertificateCancelDeletionOptions object itself. + */ + public CertificateCancelDeletionOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateDeleteHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateDeleteHeaders.java new file mode 100644 index 000000000000..68755e28d6dc --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateDeleteHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Delete operation. + */ +public class CertificateDeleteHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the CertificateDeleteHeaders object itself. + */ + public CertificateDeleteHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the CertificateDeleteHeaders object itself. + */ + public CertificateDeleteHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the CertificateDeleteHeaders object itself. + */ + public CertificateDeleteHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the CertificateDeleteHeaders object itself. + */ + public CertificateDeleteHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateDeleteOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateDeleteOptions.java new file mode 100644 index 000000000000..2957fd755f02 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateDeleteOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for delete operation. + */ +public class CertificateDeleteOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the CertificateDeleteOptions object itself. + */ + public CertificateDeleteOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the CertificateDeleteOptions object itself. + */ + public CertificateDeleteOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the CertificateDeleteOptions object itself. + */ + public CertificateDeleteOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the CertificateDeleteOptions object itself. + */ + public CertificateDeleteOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateFormat.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateFormat.java new file mode 100644 index 000000000000..393079d1dcfb --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateFormat.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CertificateFormat. + */ +public enum CertificateFormat { + /** The certificate is a PFX (PKCS#12) formatted certificate or certificate chain. */ + PFX("pfx"), + + /** The certificate is a base64-encoded X.509 certificate. */ + CER("cer"); + + /** The actual serialized value for a CertificateFormat instance. */ + private String value; + + CertificateFormat(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CertificateFormat instance. + * + * @param value the serialized value to parse. + * @return the parsed CertificateFormat object, or null if unable to parse. + */ + @JsonCreator + public static CertificateFormat fromString(String value) { + CertificateFormat[] items = CertificateFormat.values(); + for (CertificateFormat item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateGetHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateGetHeaders.java new file mode 100644 index 000000000000..3bb849044271 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateGetHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class CertificateGetHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the CertificateGetHeaders object itself. + */ + public CertificateGetHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the CertificateGetHeaders object itself. + */ + public CertificateGetHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the CertificateGetHeaders object itself. + */ + public CertificateGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the CertificateGetHeaders object itself. + */ + public CertificateGetHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateGetOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateGetOptions.java new file mode 100644 index 000000000000..7f2a6e5c0319 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateGetOptions.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for get operation. + */ +public class CertificateGetOptions { + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the CertificateGetOptions object itself. + */ + public CertificateGetOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the CertificateGetOptions object itself. + */ + public CertificateGetOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the CertificateGetOptions object itself. + */ + public CertificateGetOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the CertificateGetOptions object itself. + */ + public CertificateGetOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the CertificateGetOptions object itself. + */ + public CertificateGetOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateListHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateListHeaders.java new file mode 100644 index 000000000000..60ca8b4c805b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateListHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for List operation. + */ +public class CertificateListHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the CertificateListHeaders object itself. + */ + public CertificateListHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the CertificateListHeaders object itself. + */ + public CertificateListHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the CertificateListHeaders object itself. + */ + public CertificateListHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the CertificateListHeaders object itself. + */ + public CertificateListHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateListNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateListNextOptions.java new file mode 100644 index 000000000000..ab86494a7e33 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateListNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listNext operation. + */ +public class CertificateListNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the CertificateListNextOptions object itself. + */ + public CertificateListNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the CertificateListNextOptions object itself. + */ + public CertificateListNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the CertificateListNextOptions object itself. + */ + public CertificateListNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateListOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateListOptions.java new file mode 100644 index 000000000000..7cfdd4bc7cbb --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateListOptions.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for list operation. + */ +public class CertificateListOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-certificates. + */ + @JsonProperty(value = "") + private String filter; + + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * certificates can be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-certificates. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-certificates. + * + * @param filter the filter value to set + * @return the CertificateListOptions object itself. + */ + public CertificateListOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the CertificateListOptions object itself. + */ + public CertificateListOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 certificates can be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 certificates can be returned. + * + * @param maxResults the maxResults value to set + * @return the CertificateListOptions object itself. + */ + public CertificateListOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the CertificateListOptions object itself. + */ + public CertificateListOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the CertificateListOptions object itself. + */ + public CertificateListOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the CertificateListOptions object itself. + */ + public CertificateListOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the CertificateListOptions object itself. + */ + public CertificateListOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateReference.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateReference.java new file mode 100644 index 000000000000..db6028f7ecb1 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateReference.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A reference to a certificate to be installed on compute nodes in a pool. + */ +public class CertificateReference { + /** + * The thumbprint of the certificate. + */ + @JsonProperty(value = "thumbprint", required = true) + private String thumbprint; + + /** + * The algorithm with which the thumbprint is associated. This must be + * sha1. + */ + @JsonProperty(value = "thumbprintAlgorithm", required = true) + private String thumbprintAlgorithm; + + /** + * The location of the certificate store on the compute node into which to + * install the certificate. + * The default value is currentuser. This property is applicable only for + * pools configured with Windows nodes (that is, created with + * cloudServiceConfiguration, or with virtualMachineConfiguration using a + * Windows image reference). For Linux compute nodes, the certificates are + * stored in a directory inside the task working directory and an + * environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task + * to query for this location. For certificates with visibility of + * 'remoteUser', a 'certs' directory is created in the user's home + * directory (e.g., /home/{user-name}/certs) and certificates are placed in + * that directory. Possible values include: 'currentUser', 'localMachine'. + */ + @JsonProperty(value = "storeLocation") + private CertificateStoreLocation storeLocation; + + /** + * The name of the certificate store on the compute node into which to + * install the certificate. + * This property is applicable only for pools configured with Windows nodes + * (that is, created with cloudServiceConfiguration, or with + * virtualMachineConfiguration using a Windows image reference). Common + * store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, + * TrustedPublisher, AuthRoot, AddressBook, but any custom store name can + * also be used. The default value is My. + */ + @JsonProperty(value = "storeName") + private String storeName; + + /** + * Which user accounts on the compute node should have access to the + * private data of the certificate. + * You can specify more than one visibility in this collection. The default + * is all accounts. + */ + @JsonProperty(value = "visibility") + private List visibility; + + /** + * Get the thumbprint value. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint value. + * + * @param thumbprint the thumbprint value to set + * @return the CertificateReference object itself. + */ + public CertificateReference withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the thumbprintAlgorithm value. + * + * @return the thumbprintAlgorithm value + */ + public String thumbprintAlgorithm() { + return this.thumbprintAlgorithm; + } + + /** + * Set the thumbprintAlgorithm value. + * + * @param thumbprintAlgorithm the thumbprintAlgorithm value to set + * @return the CertificateReference object itself. + */ + public CertificateReference withThumbprintAlgorithm(String thumbprintAlgorithm) { + this.thumbprintAlgorithm = thumbprintAlgorithm; + return this; + } + + /** + * Get the default value is currentuser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. Possible values include: 'currentUser', 'localMachine'. + * + * @return the storeLocation value + */ + public CertificateStoreLocation storeLocation() { + return this.storeLocation; + } + + /** + * Set the default value is currentuser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. Possible values include: 'currentUser', 'localMachine'. + * + * @param storeLocation the storeLocation value to set + * @return the CertificateReference object itself. + */ + public CertificateReference withStoreLocation(CertificateStoreLocation storeLocation) { + this.storeLocation = storeLocation; + return this; + } + + /** + * Get this property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. + * + * @return the storeName value + */ + public String storeName() { + return this.storeName; + } + + /** + * Set this property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. + * + * @param storeName the storeName value to set + * @return the CertificateReference object itself. + */ + public CertificateReference withStoreName(String storeName) { + this.storeName = storeName; + return this; + } + + /** + * Get you can specify more than one visibility in this collection. The default is all accounts. + * + * @return the visibility value + */ + public List visibility() { + return this.visibility; + } + + /** + * Set you can specify more than one visibility in this collection. The default is all accounts. + * + * @param visibility the visibility value to set + * @return the CertificateReference object itself. + */ + public CertificateReference withVisibility(List visibility) { + this.visibility = visibility; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateState.java new file mode 100644 index 000000000000..0d0a8152c3ed --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateState.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CertificateState. + */ +public enum CertificateState { + /** The certificate is available for use in pools. */ + ACTIVE("active"), + + /** The user has requested that the certificate be deleted, but the delete operation has not yet completed. You may not reference the certificate when creating or updating pools. */ + DELETING("deleting"), + + /** The user requested that the certificate be deleted, but there are pools that still have references to the certificate, or it is still installed on one or more compute nodes. (The latter can occur if the certificate has been removed from the pool, but the node has not yet restarted. Nodes refresh their certificates only when they restart.) You may use the cancel certificate delete operation to cancel the delete, or the delete certificate operation to retry the delete. */ + DELETE_FAILED("deletefailed"); + + /** The actual serialized value for a CertificateState instance. */ + private String value; + + CertificateState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CertificateState instance. + * + * @param value the serialized value to parse. + * @return the parsed CertificateState object, or null if unable to parse. + */ + @JsonCreator + public static CertificateState fromString(String value) { + CertificateState[] items = CertificateState.values(); + for (CertificateState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateStoreLocation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateStoreLocation.java new file mode 100644 index 000000000000..e5de177913da --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateStoreLocation.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CertificateStoreLocation. + */ +public enum CertificateStoreLocation { + /** Certificates should be installed to the CurrentUser certificate store. */ + CURRENT_USER("currentuser"), + + /** Certificates should be installed to the LocalMachine certificate store. */ + LOCAL_MACHINE("localmachine"); + + /** The actual serialized value for a CertificateStoreLocation instance. */ + private String value; + + CertificateStoreLocation(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CertificateStoreLocation instance. + * + * @param value the serialized value to parse. + * @return the parsed CertificateStoreLocation object, or null if unable to parse. + */ + @JsonCreator + public static CertificateStoreLocation fromString(String value) { + CertificateStoreLocation[] items = CertificateStoreLocation.values(); + for (CertificateStoreLocation item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateVisibility.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateVisibility.java new file mode 100644 index 000000000000..aa86f67ac996 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CertificateVisibility.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CertificateVisibility. + */ +public enum CertificateVisibility { + /** The certificate should be visible to the user account under which the start task is run. */ + START_TASK("starttask"), + + /** The certificate should be visible to the user accounts under which job tasks are run. */ + TASK("task"), + + /** The certificate should be visible to the user accounts under which users remotely access the node. */ + REMOTE_USER("remoteuser"); + + /** The actual serialized value for a CertificateVisibility instance. */ + private String value; + + CertificateVisibility(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CertificateVisibility instance. + * + * @param value the serialized value to parse. + * @return the parsed CertificateVisibility object, or null if unable to parse. + */ + @JsonCreator + public static CertificateVisibility fromString(String value) { + CertificateVisibility[] items = CertificateVisibility.values(); + for (CertificateVisibility item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudJob.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudJob.java new file mode 100644 index 000000000000..9ebf226e3015 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudJob.java @@ -0,0 +1,678 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Azure Batch job. + */ +public class CloudJob { + /** + * A string that uniquely identifies the job within the account. + * The ID is case-preserving and case-insensitive (that is, you may not + * have two IDs within an account that differ only by case). + */ + @JsonProperty(value = "id") + private String id; + + /** + * The display name for the job. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Whether tasks in the job can define dependencies on each other. The + * default is false. + */ + @JsonProperty(value = "usesTaskDependencies") + private Boolean usesTaskDependencies; + + /** + * The URL of the job. + */ + @JsonProperty(value = "url") + private String url; + + /** + * The ETag of the job. + * This is an opaque string. You can use it to detect whether the job has + * changed between requests. In particular, you can be pass the ETag when + * updating a job to specify that your changes should take effect only if + * nobody else has modified the job in the meantime. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * The last modified time of the job. + * This is the last time at which the job level data, such as the job state + * or priority, changed. It does not factor in task-level changes such as + * adding new tasks or tasks changing state. + */ + @JsonProperty(value = "lastModified") + private DateTime lastModified; + + /** + * The creation time of the job. + */ + @JsonProperty(value = "creationTime") + private DateTime creationTime; + + /** + * The current state of the job. + * Possible values include: 'active', 'disabling', 'disabled', 'enabling', + * 'terminating', 'completed', 'deleting'. + */ + @JsonProperty(value = "state") + private JobState state; + + /** + * The time at which the job entered its current state. + */ + @JsonProperty(value = "stateTransitionTime") + private DateTime stateTransitionTime; + + /** + * The previous state of the job. + * This property is not set if the job is in its initial Active state. + * Possible values include: 'active', 'disabling', 'disabled', 'enabling', + * 'terminating', 'completed', 'deleting'. + */ + @JsonProperty(value = "previousState") + private JobState previousState; + + /** + * The time at which the job entered its previous state. + * This property is not set if the job is in its initial Active state. + */ + @JsonProperty(value = "previousStateTransitionTime") + private DateTime previousStateTransitionTime; + + /** + * The priority of the job. + * Priority values can range from -1000 to 1000, with -1000 being the + * lowest priority and 1000 being the highest priority. The default value + * is 0. + */ + @JsonProperty(value = "priority") + private Integer priority; + + /** + * The execution constraints for the job. + */ + @JsonProperty(value = "constraints") + private JobConstraints constraints; + + /** + * Details of a Job Manager task to be launched when the job is started. + */ + @JsonProperty(value = "jobManagerTask") + private JobManagerTask jobManagerTask; + + /** + * The Job Preparation task. + * The Job Preparation task is a special task run on each node before any + * other task of the job. + */ + @JsonProperty(value = "jobPreparationTask") + private JobPreparationTask jobPreparationTask; + + /** + * The Job Release task. + * The Job Release task is a special task run at the end of the job on each + * node that has run any other task of the job. + */ + @JsonProperty(value = "jobReleaseTask") + private JobReleaseTask jobReleaseTask; + + /** + * The list of common environment variable settings. These environment + * variables are set for all tasks in the job (including the Job Manager, + * Job Preparation and Job Release tasks). + * Individual tasks can override an environment setting specified here by + * specifying the same setting name with a different value. + */ + @JsonProperty(value = "commonEnvironmentSettings") + private List commonEnvironmentSettings; + + /** + * The pool settings associated with the job. + */ + @JsonProperty(value = "poolInfo") + private PoolInformation poolInfo; + + /** + * The action the Batch service should take when all tasks in the job are + * in the completed state. + * The default is noaction. Possible values include: 'noAction', + * 'terminateJob'. + */ + @JsonProperty(value = "onAllTasksComplete") + private OnAllTasksComplete onAllTasksComplete; + + /** + * The action the Batch service should take when any task in the job fails. + * A task is considered to have failed if has a failureInfo. A failureInfo + * is set if the task completes with a non-zero exit code after exhausting + * its retry count, or if there was an error starting the task, for example + * due to a resource file download error. The default is noaction. Possible + * values include: 'noAction', 'performExitOptionsJobAction'. + */ + @JsonProperty(value = "onTaskFailure") + private OnTaskFailure onTaskFailure; + + /** + * The network configuration for the job. + */ + @JsonProperty(value = "networkConfiguration") + private JobNetworkConfiguration networkConfiguration; + + /** + * A list of name-value pairs associated with the job as metadata. + * The Batch service does not assign any meaning to metadata; it is solely + * for the use of user code. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * The execution information for the job. + */ + @JsonProperty(value = "executionInfo") + private JobExecutionInformation executionInfo; + + /** + * Resource usage statistics for the entire lifetime of the job. The + * statistics may not be immediately available. The Batch service performs + * periodic roll-up of statistics. The typical delay is about 30 minutes. + */ + @JsonProperty(value = "stats") + private JobStatistics stats; + + /** + * Get the ID is case-preserving and case-insensitive (that is, you may not have two IDs within an account that differ only by case). + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID is case-preserving and case-insensitive (that is, you may not have two IDs within an account that differ only by case). + * + * @param id the id value to set + * @return the CloudJob object itself. + */ + public CloudJob withId(String id) { + this.id = id; + return this; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the CloudJob object itself. + */ + public CloudJob withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the usesTaskDependencies value. + * + * @return the usesTaskDependencies value + */ + public Boolean usesTaskDependencies() { + return this.usesTaskDependencies; + } + + /** + * Set the usesTaskDependencies value. + * + * @param usesTaskDependencies the usesTaskDependencies value to set + * @return the CloudJob object itself. + */ + public CloudJob withUsesTaskDependencies(Boolean usesTaskDependencies) { + this.usesTaskDependencies = usesTaskDependencies; + return this; + } + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the CloudJob object itself. + */ + public CloudJob withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get this is an opaque string. You can use it to detect whether the job has changed between requests. In particular, you can be pass the ETag when updating a job to specify that your changes should take effect only if nobody else has modified the job in the meantime. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set this is an opaque string. You can use it to detect whether the job has changed between requests. In particular, you can be pass the ETag when updating a job to specify that your changes should take effect only if nobody else has modified the job in the meantime. + * + * @param eTag the eTag value to set + * @return the CloudJob object itself. + */ + public CloudJob withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get this is the last time at which the job level data, such as the job state or priority, changed. It does not factor in task-level changes such as adding new tasks or tasks changing state. + * + * @return the lastModified value + */ + public DateTime lastModified() { + return this.lastModified; + } + + /** + * Set this is the last time at which the job level data, such as the job state or priority, changed. It does not factor in task-level changes such as adding new tasks or tasks changing state. + * + * @param lastModified the lastModified value to set + * @return the CloudJob object itself. + */ + public CloudJob withLastModified(DateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * Get the creationTime value. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + + /** + * Set the creationTime value. + * + * @param creationTime the creationTime value to set + * @return the CloudJob object itself. + */ + public CloudJob withCreationTime(DateTime creationTime) { + this.creationTime = creationTime; + return this; + } + + /** + * Get possible values include: 'active', 'disabling', 'disabled', 'enabling', 'terminating', 'completed', 'deleting'. + * + * @return the state value + */ + public JobState state() { + return this.state; + } + + /** + * Set possible values include: 'active', 'disabling', 'disabled', 'enabling', 'terminating', 'completed', 'deleting'. + * + * @param state the state value to set + * @return the CloudJob object itself. + */ + public CloudJob withState(JobState state) { + this.state = state; + return this; + } + + /** + * Get the stateTransitionTime value. + * + * @return the stateTransitionTime value + */ + public DateTime stateTransitionTime() { + return this.stateTransitionTime; + } + + /** + * Set the stateTransitionTime value. + * + * @param stateTransitionTime the stateTransitionTime value to set + * @return the CloudJob object itself. + */ + public CloudJob withStateTransitionTime(DateTime stateTransitionTime) { + this.stateTransitionTime = stateTransitionTime; + return this; + } + + /** + * Get this property is not set if the job is in its initial Active state. Possible values include: 'active', 'disabling', 'disabled', 'enabling', 'terminating', 'completed', 'deleting'. + * + * @return the previousState value + */ + public JobState previousState() { + return this.previousState; + } + + /** + * Set this property is not set if the job is in its initial Active state. Possible values include: 'active', 'disabling', 'disabled', 'enabling', 'terminating', 'completed', 'deleting'. + * + * @param previousState the previousState value to set + * @return the CloudJob object itself. + */ + public CloudJob withPreviousState(JobState previousState) { + this.previousState = previousState; + return this; + } + + /** + * Get this property is not set if the job is in its initial Active state. + * + * @return the previousStateTransitionTime value + */ + public DateTime previousStateTransitionTime() { + return this.previousStateTransitionTime; + } + + /** + * Set this property is not set if the job is in its initial Active state. + * + * @param previousStateTransitionTime the previousStateTransitionTime value to set + * @return the CloudJob object itself. + */ + public CloudJob withPreviousStateTransitionTime(DateTime previousStateTransitionTime) { + this.previousStateTransitionTime = previousStateTransitionTime; + return this; + } + + /** + * Get priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. + * + * @return the priority value + */ + public Integer priority() { + return this.priority; + } + + /** + * Set priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. + * + * @param priority the priority value to set + * @return the CloudJob object itself. + */ + public CloudJob withPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get the constraints value. + * + * @return the constraints value + */ + public JobConstraints constraints() { + return this.constraints; + } + + /** + * Set the constraints value. + * + * @param constraints the constraints value to set + * @return the CloudJob object itself. + */ + public CloudJob withConstraints(JobConstraints constraints) { + this.constraints = constraints; + return this; + } + + /** + * Get the jobManagerTask value. + * + * @return the jobManagerTask value + */ + public JobManagerTask jobManagerTask() { + return this.jobManagerTask; + } + + /** + * Set the jobManagerTask value. + * + * @param jobManagerTask the jobManagerTask value to set + * @return the CloudJob object itself. + */ + public CloudJob withJobManagerTask(JobManagerTask jobManagerTask) { + this.jobManagerTask = jobManagerTask; + return this; + } + + /** + * Get the Job Preparation task is a special task run on each node before any other task of the job. + * + * @return the jobPreparationTask value + */ + public JobPreparationTask jobPreparationTask() { + return this.jobPreparationTask; + } + + /** + * Set the Job Preparation task is a special task run on each node before any other task of the job. + * + * @param jobPreparationTask the jobPreparationTask value to set + * @return the CloudJob object itself. + */ + public CloudJob withJobPreparationTask(JobPreparationTask jobPreparationTask) { + this.jobPreparationTask = jobPreparationTask; + return this; + } + + /** + * Get the Job Release task is a special task run at the end of the job on each node that has run any other task of the job. + * + * @return the jobReleaseTask value + */ + public JobReleaseTask jobReleaseTask() { + return this.jobReleaseTask; + } + + /** + * Set the Job Release task is a special task run at the end of the job on each node that has run any other task of the job. + * + * @param jobReleaseTask the jobReleaseTask value to set + * @return the CloudJob object itself. + */ + public CloudJob withJobReleaseTask(JobReleaseTask jobReleaseTask) { + this.jobReleaseTask = jobReleaseTask; + return this; + } + + /** + * Get individual tasks can override an environment setting specified here by specifying the same setting name with a different value. + * + * @return the commonEnvironmentSettings value + */ + public List commonEnvironmentSettings() { + return this.commonEnvironmentSettings; + } + + /** + * Set individual tasks can override an environment setting specified here by specifying the same setting name with a different value. + * + * @param commonEnvironmentSettings the commonEnvironmentSettings value to set + * @return the CloudJob object itself. + */ + public CloudJob withCommonEnvironmentSettings(List commonEnvironmentSettings) { + this.commonEnvironmentSettings = commonEnvironmentSettings; + return this; + } + + /** + * Get the poolInfo value. + * + * @return the poolInfo value + */ + public PoolInformation poolInfo() { + return this.poolInfo; + } + + /** + * Set the poolInfo value. + * + * @param poolInfo the poolInfo value to set + * @return the CloudJob object itself. + */ + public CloudJob withPoolInfo(PoolInformation poolInfo) { + this.poolInfo = poolInfo; + return this; + } + + /** + * Get the default is noaction. Possible values include: 'noAction', 'terminateJob'. + * + * @return the onAllTasksComplete value + */ + public OnAllTasksComplete onAllTasksComplete() { + return this.onAllTasksComplete; + } + + /** + * Set the default is noaction. Possible values include: 'noAction', 'terminateJob'. + * + * @param onAllTasksComplete the onAllTasksComplete value to set + * @return the CloudJob object itself. + */ + public CloudJob withOnAllTasksComplete(OnAllTasksComplete onAllTasksComplete) { + this.onAllTasksComplete = onAllTasksComplete; + return this; + } + + /** + * Get a task is considered to have failed if has a failureInfo. A failureInfo is set if the task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the task, for example due to a resource file download error. The default is noaction. Possible values include: 'noAction', 'performExitOptionsJobAction'. + * + * @return the onTaskFailure value + */ + public OnTaskFailure onTaskFailure() { + return this.onTaskFailure; + } + + /** + * Set a task is considered to have failed if has a failureInfo. A failureInfo is set if the task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the task, for example due to a resource file download error. The default is noaction. Possible values include: 'noAction', 'performExitOptionsJobAction'. + * + * @param onTaskFailure the onTaskFailure value to set + * @return the CloudJob object itself. + */ + public CloudJob withOnTaskFailure(OnTaskFailure onTaskFailure) { + this.onTaskFailure = onTaskFailure; + return this; + } + + /** + * Get the networkConfiguration value. + * + * @return the networkConfiguration value + */ + public JobNetworkConfiguration networkConfiguration() { + return this.networkConfiguration; + } + + /** + * Set the networkConfiguration value. + * + * @param networkConfiguration the networkConfiguration value to set + * @return the CloudJob object itself. + */ + public CloudJob withNetworkConfiguration(JobNetworkConfiguration networkConfiguration) { + this.networkConfiguration = networkConfiguration; + return this; + } + + /** + * Get the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @param metadata the metadata value to set + * @return the CloudJob object itself. + */ + public CloudJob withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the executionInfo value. + * + * @return the executionInfo value + */ + public JobExecutionInformation executionInfo() { + return this.executionInfo; + } + + /** + * Set the executionInfo value. + * + * @param executionInfo the executionInfo value to set + * @return the CloudJob object itself. + */ + public CloudJob withExecutionInfo(JobExecutionInformation executionInfo) { + this.executionInfo = executionInfo; + return this; + } + + /** + * Get the stats value. + * + * @return the stats value + */ + public JobStatistics stats() { + return this.stats; + } + + /** + * Set the stats value. + * + * @param stats the stats value to set + * @return the CloudJob object itself. + */ + public CloudJob withStats(JobStatistics stats) { + this.stats = stats; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudJobSchedule.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudJobSchedule.java new file mode 100644 index 000000000000..6f2bbd664dd6 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudJobSchedule.java @@ -0,0 +1,426 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A job schedule that allows recurring jobs by specifying when to run jobs and + * a specification used to create each job. + */ +public class CloudJobSchedule { + /** + * A string that uniquely identifies the schedule within the account. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The display name for the schedule. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The URL of the job schedule. + */ + @JsonProperty(value = "url") + private String url; + + /** + * The ETag of the job schedule. + * This is an opaque string. You can use it to detect whether the job + * schedule has changed between requests. In particular, you can be pass + * the ETag with an Update Job Schedule request to specify that your + * changes should take effect only if nobody else has modified the schedule + * in the meantime. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * The last modified time of the job schedule. + * This is the last time at which the schedule level data, such as the job + * specification or recurrence information, changed. It does not factor in + * job-level changes such as new jobs being created or jobs changing state. + */ + @JsonProperty(value = "lastModified") + private DateTime lastModified; + + /** + * The creation time of the job schedule. + */ + @JsonProperty(value = "creationTime") + private DateTime creationTime; + + /** + * The current state of the job schedule. + * Possible values include: 'active', 'completed', 'disabled', + * 'terminating', 'deleting'. + */ + @JsonProperty(value = "state") + private JobScheduleState state; + + /** + * The time at which the job schedule entered the current state. + */ + @JsonProperty(value = "stateTransitionTime") + private DateTime stateTransitionTime; + + /** + * The previous state of the job schedule. + * This property is not present if the job schedule is in its initial + * active state. Possible values include: 'active', 'completed', + * 'disabled', 'terminating', 'deleting'. + */ + @JsonProperty(value = "previousState") + private JobScheduleState previousState; + + /** + * The time at which the job schedule entered its previous state. + * This property is not present if the job schedule is in its initial + * active state. + */ + @JsonProperty(value = "previousStateTransitionTime") + private DateTime previousStateTransitionTime; + + /** + * The schedule according to which jobs will be created. + */ + @JsonProperty(value = "schedule") + private Schedule schedule; + + /** + * The details of the jobs to be created on this schedule. + */ + @JsonProperty(value = "jobSpecification") + private JobSpecification jobSpecification; + + /** + * Information about jobs that have been and will be run under this + * schedule. + */ + @JsonProperty(value = "executionInfo") + private JobScheduleExecutionInformation executionInfo; + + /** + * A list of name-value pairs associated with the schedule as metadata. + * The Batch service does not assign any meaning to metadata; it is solely + * for the use of user code. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * The lifetime resource usage statistics for the job schedule. The + * statistics may not be immediately available. The Batch service performs + * periodic roll-up of statistics. The typical delay is about 30 minutes. + */ + @JsonProperty(value = "stats") + private JobScheduleStatistics stats; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withId(String id) { + this.id = id; + return this; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get this is an opaque string. You can use it to detect whether the job schedule has changed between requests. In particular, you can be pass the ETag with an Update Job Schedule request to specify that your changes should take effect only if nobody else has modified the schedule in the meantime. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set this is an opaque string. You can use it to detect whether the job schedule has changed between requests. In particular, you can be pass the ETag with an Update Job Schedule request to specify that your changes should take effect only if nobody else has modified the schedule in the meantime. + * + * @param eTag the eTag value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get this is the last time at which the schedule level data, such as the job specification or recurrence information, changed. It does not factor in job-level changes such as new jobs being created or jobs changing state. + * + * @return the lastModified value + */ + public DateTime lastModified() { + return this.lastModified; + } + + /** + * Set this is the last time at which the schedule level data, such as the job specification or recurrence information, changed. It does not factor in job-level changes such as new jobs being created or jobs changing state. + * + * @param lastModified the lastModified value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withLastModified(DateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * Get the creationTime value. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + + /** + * Set the creationTime value. + * + * @param creationTime the creationTime value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withCreationTime(DateTime creationTime) { + this.creationTime = creationTime; + return this; + } + + /** + * Get possible values include: 'active', 'completed', 'disabled', 'terminating', 'deleting'. + * + * @return the state value + */ + public JobScheduleState state() { + return this.state; + } + + /** + * Set possible values include: 'active', 'completed', 'disabled', 'terminating', 'deleting'. + * + * @param state the state value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withState(JobScheduleState state) { + this.state = state; + return this; + } + + /** + * Get the stateTransitionTime value. + * + * @return the stateTransitionTime value + */ + public DateTime stateTransitionTime() { + return this.stateTransitionTime; + } + + /** + * Set the stateTransitionTime value. + * + * @param stateTransitionTime the stateTransitionTime value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withStateTransitionTime(DateTime stateTransitionTime) { + this.stateTransitionTime = stateTransitionTime; + return this; + } + + /** + * Get this property is not present if the job schedule is in its initial active state. Possible values include: 'active', 'completed', 'disabled', 'terminating', 'deleting'. + * + * @return the previousState value + */ + public JobScheduleState previousState() { + return this.previousState; + } + + /** + * Set this property is not present if the job schedule is in its initial active state. Possible values include: 'active', 'completed', 'disabled', 'terminating', 'deleting'. + * + * @param previousState the previousState value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withPreviousState(JobScheduleState previousState) { + this.previousState = previousState; + return this; + } + + /** + * Get this property is not present if the job schedule is in its initial active state. + * + * @return the previousStateTransitionTime value + */ + public DateTime previousStateTransitionTime() { + return this.previousStateTransitionTime; + } + + /** + * Set this property is not present if the job schedule is in its initial active state. + * + * @param previousStateTransitionTime the previousStateTransitionTime value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withPreviousStateTransitionTime(DateTime previousStateTransitionTime) { + this.previousStateTransitionTime = previousStateTransitionTime; + return this; + } + + /** + * Get the schedule value. + * + * @return the schedule value + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set the schedule value. + * + * @param schedule the schedule value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the jobSpecification value. + * + * @return the jobSpecification value + */ + public JobSpecification jobSpecification() { + return this.jobSpecification; + } + + /** + * Set the jobSpecification value. + * + * @param jobSpecification the jobSpecification value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withJobSpecification(JobSpecification jobSpecification) { + this.jobSpecification = jobSpecification; + return this; + } + + /** + * Get the executionInfo value. + * + * @return the executionInfo value + */ + public JobScheduleExecutionInformation executionInfo() { + return this.executionInfo; + } + + /** + * Set the executionInfo value. + * + * @param executionInfo the executionInfo value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withExecutionInfo(JobScheduleExecutionInformation executionInfo) { + this.executionInfo = executionInfo; + return this; + } + + /** + * Get the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @param metadata the metadata value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the stats value. + * + * @return the stats value + */ + public JobScheduleStatistics stats() { + return this.stats; + } + + /** + * Set the stats value. + * + * @param stats the stats value to set + * @return the CloudJobSchedule object itself. + */ + public CloudJobSchedule withStats(JobScheduleStatistics stats) { + this.stats = stats; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudPool.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudPool.java new file mode 100644 index 000000000000..1f6d50316efc --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudPool.java @@ -0,0 +1,965 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import org.joda.time.Period; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A pool in the Azure Batch service. + */ +public class CloudPool { + /** + * A string that uniquely identifies the pool within the account. + * The ID can contain any combination of alphanumeric characters including + * hyphens and underscores, and cannot contain more than 64 characters. The + * ID is case-preserving and case-insensitive (that is, you may not have + * two IDs within an account that differ only by case). + */ + @JsonProperty(value = "id") + private String id; + + /** + * The display name for the pool. + * The display name need not be unique and can contain any Unicode + * characters up to a maximum length of 1024. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The URL of the pool. + */ + @JsonProperty(value = "url") + private String url; + + /** + * The ETag of the pool. + * This is an opaque string. You can use it to detect whether the pool has + * changed between requests. In particular, you can be pass the ETag when + * updating a pool to specify that your changes should take effect only if + * nobody else has modified the pool in the meantime. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * The last modified time of the pool. + * This is the last time at which the pool level data, such as the + * targetDedicatedNodes or enableAutoscale settings, changed. It does not + * factor in node-level changes such as a compute node changing state. + */ + @JsonProperty(value = "lastModified") + private DateTime lastModified; + + /** + * The creation time of the pool. + */ + @JsonProperty(value = "creationTime") + private DateTime creationTime; + + /** + * The current state of the pool. + * Possible values include: 'active', 'deleting'. + */ + @JsonProperty(value = "state") + private PoolState state; + + /** + * The time at which the pool entered its current state. + */ + @JsonProperty(value = "stateTransitionTime") + private DateTime stateTransitionTime; + + /** + * Whether the pool is resizing. + * Possible values include: 'steady', 'resizing', 'stopping'. + */ + @JsonProperty(value = "allocationState") + private AllocationState allocationState; + + /** + * The time at which the pool entered its current allocation state. + */ + @JsonProperty(value = "allocationStateTransitionTime") + private DateTime allocationStateTransitionTime; + + /** + * The size of virtual machines in the pool. All virtual machines in a pool + * are the same size. + * For information about available sizes of virtual machines in pools, see + * Choose a VM size for compute nodes in an Azure Batch pool + * (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + */ + @JsonProperty(value = "vmSize") + private String vmSize; + + /** + * The cloud service configuration for the pool. + * This property and virtualMachineConfiguration are mutually exclusive and + * one of the properties must be specified. This property cannot be + * specified if the Batch account was created with its poolAllocationMode + * property set to 'UserSubscription'. + */ + @JsonProperty(value = "cloudServiceConfiguration") + private CloudServiceConfiguration cloudServiceConfiguration; + + /** + * The virtual machine configuration for the pool. + * This property and cloudServiceConfiguration are mutually exclusive and + * one of the properties must be specified. + */ + @JsonProperty(value = "virtualMachineConfiguration") + private VirtualMachineConfiguration virtualMachineConfiguration; + + /** + * The timeout for allocation of compute nodes to the pool. + * This is the timeout for the most recent resize operation. (The initial + * sizing when the pool is created counts as a resize.) The default value + * is 15 minutes. + */ + @JsonProperty(value = "resizeTimeout") + private Period resizeTimeout; + + /** + * A list of errors encountered while performing the last resize on the + * pool. + * This property is set only if one or more errors occurred during the last + * pool resize, and only when the pool allocationState is Steady. + */ + @JsonProperty(value = "resizeErrors") + private List resizeErrors; + + /** + * The number of dedicated compute nodes currently in the pool. + */ + @JsonProperty(value = "currentDedicatedNodes") + private Integer currentDedicatedNodes; + + /** + * The number of low-priority compute nodes currently in the pool. + * Low-priority compute nodes which have been preempted are included in + * this count. + */ + @JsonProperty(value = "currentLowPriorityNodes") + private Integer currentLowPriorityNodes; + + /** + * The desired number of dedicated compute nodes in the pool. + */ + @JsonProperty(value = "targetDedicatedNodes") + private Integer targetDedicatedNodes; + + /** + * The desired number of low-priority compute nodes in the pool. + */ + @JsonProperty(value = "targetLowPriorityNodes") + private Integer targetLowPriorityNodes; + + /** + * Whether the pool size should automatically adjust over time. + * If false, at least one of targetDedicateNodes and targetLowPriorityNodes + * must be specified. If true, the autoScaleFormula property is required + * and the pool automatically resizes according to the formula. The default + * value is false. + */ + @JsonProperty(value = "enableAutoScale") + private Boolean enableAutoScale; + + /** + * A formula for the desired number of compute nodes in the pool. + * This property is set only if the pool automatically scales, i.e. + * enableAutoScale is true. + */ + @JsonProperty(value = "autoScaleFormula") + private String autoScaleFormula; + + /** + * The time interval at which to automatically adjust the pool size + * according to the autoscale formula. + * This property is set only if the pool automatically scales, i.e. + * enableAutoScale is true. + */ + @JsonProperty(value = "autoScaleEvaluationInterval") + private Period autoScaleEvaluationInterval; + + /** + * The results and errors from the last execution of the autoscale formula. + * This property is set only if the pool automatically scales, i.e. + * enableAutoScale is true. + */ + @JsonProperty(value = "autoScaleRun") + private AutoScaleRun autoScaleRun; + + /** + * Whether the pool permits direct communication between nodes. + * This imposes restrictions on which nodes can be assigned to the pool. + * Specifying this value can reduce the chance of the requested number of + * nodes to be allocated in the pool. + */ + @JsonProperty(value = "enableInterNodeCommunication") + private Boolean enableInterNodeCommunication; + + /** + * The network configuration for the pool. + */ + @JsonProperty(value = "networkConfiguration") + private NetworkConfiguration networkConfiguration; + + /** + * A task specified to run on each compute node as it joins the pool. + */ + @JsonProperty(value = "startTask") + private StartTask startTask; + + /** + * The list of certificates to be installed on each compute node in the + * pool. + * For Windows compute nodes, the Batch service installs the certificates + * to the specified certificate store and location. For Linux compute + * nodes, the certificates are stored in a directory inside the task + * working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR + * is supplied to the task to query for this location. For certificates + * with visibility of 'remoteUser', a 'certs' directory is created in the + * user's home directory (e.g., /home/{user-name}/certs) and certificates + * are placed in that directory. + */ + @JsonProperty(value = "certificateReferences") + private List certificateReferences; + + /** + * The list of application packages to be installed on each compute node in + * the pool. + */ + @JsonProperty(value = "applicationPackageReferences") + private List applicationPackageReferences; + + /** + * The list of application licenses the Batch service will make available + * on each compute node in the pool. + * The list of application licenses must be a subset of available Batch + * service application licenses. If a license is requested which is not + * supported, pool creation will fail. + */ + @JsonProperty(value = "applicationLicenses") + private List applicationLicenses; + + /** + * The maximum number of tasks that can run concurrently on a single + * compute node in the pool. + */ + @JsonProperty(value = "maxTasksPerNode") + private Integer maxTasksPerNode; + + /** + * How tasks are distributed across compute nodes in a pool. + */ + @JsonProperty(value = "taskSchedulingPolicy") + private TaskSchedulingPolicy taskSchedulingPolicy; + + /** + * The list of user accounts to be created on each node in the pool. + */ + @JsonProperty(value = "userAccounts") + private List userAccounts; + + /** + * A list of name-value pairs associated with the pool as metadata. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Utilization and resource usage statistics for the entire lifetime of the + * pool. The statistics may not be immediately available. The Batch service + * performs periodic roll-up of statistics. The typical delay is about 30 + * minutes. + */ + @JsonProperty(value = "stats") + private PoolStatistics stats; + + /** + * Get the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an account that differ only by case). + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an account that differ only by case). + * + * @param id the id value to set + * @return the CloudPool object itself. + */ + public CloudPool withId(String id) { + this.id = id; + return this; + } + + /** + * Get the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @param displayName the displayName value to set + * @return the CloudPool object itself. + */ + public CloudPool withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the CloudPool object itself. + */ + public CloudPool withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get this is an opaque string. You can use it to detect whether the pool has changed between requests. In particular, you can be pass the ETag when updating a pool to specify that your changes should take effect only if nobody else has modified the pool in the meantime. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set this is an opaque string. You can use it to detect whether the pool has changed between requests. In particular, you can be pass the ETag when updating a pool to specify that your changes should take effect only if nobody else has modified the pool in the meantime. + * + * @param eTag the eTag value to set + * @return the CloudPool object itself. + */ + public CloudPool withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get this is the last time at which the pool level data, such as the targetDedicatedNodes or enableAutoscale settings, changed. It does not factor in node-level changes such as a compute node changing state. + * + * @return the lastModified value + */ + public DateTime lastModified() { + return this.lastModified; + } + + /** + * Set this is the last time at which the pool level data, such as the targetDedicatedNodes or enableAutoscale settings, changed. It does not factor in node-level changes such as a compute node changing state. + * + * @param lastModified the lastModified value to set + * @return the CloudPool object itself. + */ + public CloudPool withLastModified(DateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * Get the creationTime value. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + + /** + * Set the creationTime value. + * + * @param creationTime the creationTime value to set + * @return the CloudPool object itself. + */ + public CloudPool withCreationTime(DateTime creationTime) { + this.creationTime = creationTime; + return this; + } + + /** + * Get possible values include: 'active', 'deleting'. + * + * @return the state value + */ + public PoolState state() { + return this.state; + } + + /** + * Set possible values include: 'active', 'deleting'. + * + * @param state the state value to set + * @return the CloudPool object itself. + */ + public CloudPool withState(PoolState state) { + this.state = state; + return this; + } + + /** + * Get the stateTransitionTime value. + * + * @return the stateTransitionTime value + */ + public DateTime stateTransitionTime() { + return this.stateTransitionTime; + } + + /** + * Set the stateTransitionTime value. + * + * @param stateTransitionTime the stateTransitionTime value to set + * @return the CloudPool object itself. + */ + public CloudPool withStateTransitionTime(DateTime stateTransitionTime) { + this.stateTransitionTime = stateTransitionTime; + return this; + } + + /** + * Get possible values include: 'steady', 'resizing', 'stopping'. + * + * @return the allocationState value + */ + public AllocationState allocationState() { + return this.allocationState; + } + + /** + * Set possible values include: 'steady', 'resizing', 'stopping'. + * + * @param allocationState the allocationState value to set + * @return the CloudPool object itself. + */ + public CloudPool withAllocationState(AllocationState allocationState) { + this.allocationState = allocationState; + return this; + } + + /** + * Get the allocationStateTransitionTime value. + * + * @return the allocationStateTransitionTime value + */ + public DateTime allocationStateTransitionTime() { + return this.allocationStateTransitionTime; + } + + /** + * Set the allocationStateTransitionTime value. + * + * @param allocationStateTransitionTime the allocationStateTransitionTime value to set + * @return the CloudPool object itself. + */ + public CloudPool withAllocationStateTransitionTime(DateTime allocationStateTransitionTime) { + this.allocationStateTransitionTime = allocationStateTransitionTime; + return this; + } + + /** + * Get for information about available sizes of virtual machines in pools, see Choose a VM size for compute nodes in an Azure Batch pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + * + * @return the vmSize value + */ + public String vmSize() { + return this.vmSize; + } + + /** + * Set for information about available sizes of virtual machines in pools, see Choose a VM size for compute nodes in an Azure Batch pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + * + * @param vmSize the vmSize value to set + * @return the CloudPool object itself. + */ + public CloudPool withVmSize(String vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get this property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. + * + * @return the cloudServiceConfiguration value + */ + public CloudServiceConfiguration cloudServiceConfiguration() { + return this.cloudServiceConfiguration; + } + + /** + * Set this property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. + * + * @param cloudServiceConfiguration the cloudServiceConfiguration value to set + * @return the CloudPool object itself. + */ + public CloudPool withCloudServiceConfiguration(CloudServiceConfiguration cloudServiceConfiguration) { + this.cloudServiceConfiguration = cloudServiceConfiguration; + return this; + } + + /** + * Get this property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. + * + * @return the virtualMachineConfiguration value + */ + public VirtualMachineConfiguration virtualMachineConfiguration() { + return this.virtualMachineConfiguration; + } + + /** + * Set this property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. + * + * @param virtualMachineConfiguration the virtualMachineConfiguration value to set + * @return the CloudPool object itself. + */ + public CloudPool withVirtualMachineConfiguration(VirtualMachineConfiguration virtualMachineConfiguration) { + this.virtualMachineConfiguration = virtualMachineConfiguration; + return this; + } + + /** + * Get this is the timeout for the most recent resize operation. (The initial sizing when the pool is created counts as a resize.) The default value is 15 minutes. + * + * @return the resizeTimeout value + */ + public Period resizeTimeout() { + return this.resizeTimeout; + } + + /** + * Set this is the timeout for the most recent resize operation. (The initial sizing when the pool is created counts as a resize.) The default value is 15 minutes. + * + * @param resizeTimeout the resizeTimeout value to set + * @return the CloudPool object itself. + */ + public CloudPool withResizeTimeout(Period resizeTimeout) { + this.resizeTimeout = resizeTimeout; + return this; + } + + /** + * Get this property is set only if one or more errors occurred during the last pool resize, and only when the pool allocationState is Steady. + * + * @return the resizeErrors value + */ + public List resizeErrors() { + return this.resizeErrors; + } + + /** + * Set this property is set only if one or more errors occurred during the last pool resize, and only when the pool allocationState is Steady. + * + * @param resizeErrors the resizeErrors value to set + * @return the CloudPool object itself. + */ + public CloudPool withResizeErrors(List resizeErrors) { + this.resizeErrors = resizeErrors; + return this; + } + + /** + * Get the currentDedicatedNodes value. + * + * @return the currentDedicatedNodes value + */ + public Integer currentDedicatedNodes() { + return this.currentDedicatedNodes; + } + + /** + * Set the currentDedicatedNodes value. + * + * @param currentDedicatedNodes the currentDedicatedNodes value to set + * @return the CloudPool object itself. + */ + public CloudPool withCurrentDedicatedNodes(Integer currentDedicatedNodes) { + this.currentDedicatedNodes = currentDedicatedNodes; + return this; + } + + /** + * Get low-priority compute nodes which have been preempted are included in this count. + * + * @return the currentLowPriorityNodes value + */ + public Integer currentLowPriorityNodes() { + return this.currentLowPriorityNodes; + } + + /** + * Set low-priority compute nodes which have been preempted are included in this count. + * + * @param currentLowPriorityNodes the currentLowPriorityNodes value to set + * @return the CloudPool object itself. + */ + public CloudPool withCurrentLowPriorityNodes(Integer currentLowPriorityNodes) { + this.currentLowPriorityNodes = currentLowPriorityNodes; + return this; + } + + /** + * Get the targetDedicatedNodes value. + * + * @return the targetDedicatedNodes value + */ + public Integer targetDedicatedNodes() { + return this.targetDedicatedNodes; + } + + /** + * Set the targetDedicatedNodes value. + * + * @param targetDedicatedNodes the targetDedicatedNodes value to set + * @return the CloudPool object itself. + */ + public CloudPool withTargetDedicatedNodes(Integer targetDedicatedNodes) { + this.targetDedicatedNodes = targetDedicatedNodes; + return this; + } + + /** + * Get the targetLowPriorityNodes value. + * + * @return the targetLowPriorityNodes value + */ + public Integer targetLowPriorityNodes() { + return this.targetLowPriorityNodes; + } + + /** + * Set the targetLowPriorityNodes value. + * + * @param targetLowPriorityNodes the targetLowPriorityNodes value to set + * @return the CloudPool object itself. + */ + public CloudPool withTargetLowPriorityNodes(Integer targetLowPriorityNodes) { + this.targetLowPriorityNodes = targetLowPriorityNodes; + return this; + } + + /** + * Get if false, at least one of targetDedicateNodes and targetLowPriorityNodes must be specified. If true, the autoScaleFormula property is required and the pool automatically resizes according to the formula. The default value is false. + * + * @return the enableAutoScale value + */ + public Boolean enableAutoScale() { + return this.enableAutoScale; + } + + /** + * Set if false, at least one of targetDedicateNodes and targetLowPriorityNodes must be specified. If true, the autoScaleFormula property is required and the pool automatically resizes according to the formula. The default value is false. + * + * @param enableAutoScale the enableAutoScale value to set + * @return the CloudPool object itself. + */ + public CloudPool withEnableAutoScale(Boolean enableAutoScale) { + this.enableAutoScale = enableAutoScale; + return this; + } + + /** + * Get this property is set only if the pool automatically scales, i.e. enableAutoScale is true. + * + * @return the autoScaleFormula value + */ + public String autoScaleFormula() { + return this.autoScaleFormula; + } + + /** + * Set this property is set only if the pool automatically scales, i.e. enableAutoScale is true. + * + * @param autoScaleFormula the autoScaleFormula value to set + * @return the CloudPool object itself. + */ + public CloudPool withAutoScaleFormula(String autoScaleFormula) { + this.autoScaleFormula = autoScaleFormula; + return this; + } + + /** + * Get this property is set only if the pool automatically scales, i.e. enableAutoScale is true. + * + * @return the autoScaleEvaluationInterval value + */ + public Period autoScaleEvaluationInterval() { + return this.autoScaleEvaluationInterval; + } + + /** + * Set this property is set only if the pool automatically scales, i.e. enableAutoScale is true. + * + * @param autoScaleEvaluationInterval the autoScaleEvaluationInterval value to set + * @return the CloudPool object itself. + */ + public CloudPool withAutoScaleEvaluationInterval(Period autoScaleEvaluationInterval) { + this.autoScaleEvaluationInterval = autoScaleEvaluationInterval; + return this; + } + + /** + * Get this property is set only if the pool automatically scales, i.e. enableAutoScale is true. + * + * @return the autoScaleRun value + */ + public AutoScaleRun autoScaleRun() { + return this.autoScaleRun; + } + + /** + * Set this property is set only if the pool automatically scales, i.e. enableAutoScale is true. + * + * @param autoScaleRun the autoScaleRun value to set + * @return the CloudPool object itself. + */ + public CloudPool withAutoScaleRun(AutoScaleRun autoScaleRun) { + this.autoScaleRun = autoScaleRun; + return this; + } + + /** + * Get this imposes restrictions on which nodes can be assigned to the pool. Specifying this value can reduce the chance of the requested number of nodes to be allocated in the pool. + * + * @return the enableInterNodeCommunication value + */ + public Boolean enableInterNodeCommunication() { + return this.enableInterNodeCommunication; + } + + /** + * Set this imposes restrictions on which nodes can be assigned to the pool. Specifying this value can reduce the chance of the requested number of nodes to be allocated in the pool. + * + * @param enableInterNodeCommunication the enableInterNodeCommunication value to set + * @return the CloudPool object itself. + */ + public CloudPool withEnableInterNodeCommunication(Boolean enableInterNodeCommunication) { + this.enableInterNodeCommunication = enableInterNodeCommunication; + return this; + } + + /** + * Get the networkConfiguration value. + * + * @return the networkConfiguration value + */ + public NetworkConfiguration networkConfiguration() { + return this.networkConfiguration; + } + + /** + * Set the networkConfiguration value. + * + * @param networkConfiguration the networkConfiguration value to set + * @return the CloudPool object itself. + */ + public CloudPool withNetworkConfiguration(NetworkConfiguration networkConfiguration) { + this.networkConfiguration = networkConfiguration; + return this; + } + + /** + * Get the startTask value. + * + * @return the startTask value + */ + public StartTask startTask() { + return this.startTask; + } + + /** + * Set the startTask value. + * + * @param startTask the startTask value to set + * @return the CloudPool object itself. + */ + public CloudPool withStartTask(StartTask startTask) { + this.startTask = startTask; + return this; + } + + /** + * Get for Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @return the certificateReferences value + */ + public List certificateReferences() { + return this.certificateReferences; + } + + /** + * Set for Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @param certificateReferences the certificateReferences value to set + * @return the CloudPool object itself. + */ + public CloudPool withCertificateReferences(List certificateReferences) { + this.certificateReferences = certificateReferences; + return this; + } + + /** + * Get the applicationPackageReferences value. + * + * @return the applicationPackageReferences value + */ + public List applicationPackageReferences() { + return this.applicationPackageReferences; + } + + /** + * Set the applicationPackageReferences value. + * + * @param applicationPackageReferences the applicationPackageReferences value to set + * @return the CloudPool object itself. + */ + public CloudPool withApplicationPackageReferences(List applicationPackageReferences) { + this.applicationPackageReferences = applicationPackageReferences; + return this; + } + + /** + * Get the list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. + * + * @return the applicationLicenses value + */ + public List applicationLicenses() { + return this.applicationLicenses; + } + + /** + * Set the list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. + * + * @param applicationLicenses the applicationLicenses value to set + * @return the CloudPool object itself. + */ + public CloudPool withApplicationLicenses(List applicationLicenses) { + this.applicationLicenses = applicationLicenses; + return this; + } + + /** + * Get the maxTasksPerNode value. + * + * @return the maxTasksPerNode value + */ + public Integer maxTasksPerNode() { + return this.maxTasksPerNode; + } + + /** + * Set the maxTasksPerNode value. + * + * @param maxTasksPerNode the maxTasksPerNode value to set + * @return the CloudPool object itself. + */ + public CloudPool withMaxTasksPerNode(Integer maxTasksPerNode) { + this.maxTasksPerNode = maxTasksPerNode; + return this; + } + + /** + * Get the taskSchedulingPolicy value. + * + * @return the taskSchedulingPolicy value + */ + public TaskSchedulingPolicy taskSchedulingPolicy() { + return this.taskSchedulingPolicy; + } + + /** + * Set the taskSchedulingPolicy value. + * + * @param taskSchedulingPolicy the taskSchedulingPolicy value to set + * @return the CloudPool object itself. + */ + public CloudPool withTaskSchedulingPolicy(TaskSchedulingPolicy taskSchedulingPolicy) { + this.taskSchedulingPolicy = taskSchedulingPolicy; + return this; + } + + /** + * Get the userAccounts value. + * + * @return the userAccounts value + */ + public List userAccounts() { + return this.userAccounts; + } + + /** + * Set the userAccounts value. + * + * @param userAccounts the userAccounts value to set + * @return the CloudPool object itself. + */ + public CloudPool withUserAccounts(List userAccounts) { + this.userAccounts = userAccounts; + return this; + } + + /** + * Get the metadata value. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the metadata value. + * + * @param metadata the metadata value to set + * @return the CloudPool object itself. + */ + public CloudPool withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the stats value. + * + * @return the stats value + */ + public PoolStatistics stats() { + return this.stats; + } + + /** + * Set the stats value. + * + * @param stats the stats value to set + * @return the CloudPool object itself. + */ + public CloudPool withStats(PoolStatistics stats) { + this.stats = stats; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudServiceConfiguration.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudServiceConfiguration.java new file mode 100644 index 000000000000..3fb4136e5fd6 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudServiceConfiguration.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The configuration for nodes in a pool based on the Azure Cloud Services + * platform. + */ +public class CloudServiceConfiguration { + /** + * The Azure Guest OS family to be installed on the virtual machines in the + * pool. + * Possible values are: + * 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. + * 3 - OS Family 3, equivalent to Windows Server 2012. + * 4 - OS Family 4, equivalent to Windows Server 2012 R2. + * 5 - OS Family 5, equivalent to Windows Server 2016. For more + * information, see Azure Guest OS Releases + * (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + */ + @JsonProperty(value = "osFamily", required = true) + private String osFamily; + + /** + * The Azure Guest OS version to be installed on the virtual machines in + * the pool. + * The default value is * which specifies the latest operating system + * version for the specified OS family. + */ + @JsonProperty(value = "osVersion") + private String osVersion; + + /** + * Get possible values are: + 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. + 3 - OS Family 3, equivalent to Windows Server 2012. + 4 - OS Family 4, equivalent to Windows Server 2012 R2. + 5 - OS Family 5, equivalent to Windows Server 2016. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + * + * @return the osFamily value + */ + public String osFamily() { + return this.osFamily; + } + + /** + * Set possible values are: + 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. + 3 - OS Family 3, equivalent to Windows Server 2012. + 4 - OS Family 4, equivalent to Windows Server 2012 R2. + 5 - OS Family 5, equivalent to Windows Server 2016. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + * + * @param osFamily the osFamily value to set + * @return the CloudServiceConfiguration object itself. + */ + public CloudServiceConfiguration withOsFamily(String osFamily) { + this.osFamily = osFamily; + return this; + } + + /** + * Get the default value is * which specifies the latest operating system version for the specified OS family. + * + * @return the osVersion value + */ + public String osVersion() { + return this.osVersion; + } + + /** + * Set the default value is * which specifies the latest operating system version for the specified OS family. + * + * @param osVersion the osVersion value to set + * @return the CloudServiceConfiguration object itself. + */ + public CloudServiceConfiguration withOsVersion(String osVersion) { + this.osVersion = osVersion; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudTask.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudTask.java new file mode 100644 index 000000000000..c328a4267fae --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudTask.java @@ -0,0 +1,765 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Azure Batch task. + * Batch will retry tasks when a recovery operation is triggered on a compute + * node. Examples of recovery operations include (but are not limited to) when + * an unhealthy compute node is rebooted or a compute node disappeared due to + * host failure. Retries due to recovery operations are independent of and are + * not counted against the maxTaskRetryCount. Even if the maxTaskRetryCount is + * 0, an internal retry due to a recovery operation may occur. Because of this, + * all tasks should be idempotent. This means tasks need to tolerate being + * interrupted and restarted without causing any corruption or duplicate data. + * The best practice for long running tasks is to use some form of + * checkpointing. + */ +public class CloudTask { + /** + * A string that uniquely identifies the task within the job. + * The ID can contain any combination of alphanumeric characters including + * hyphens and underscores, and cannot contain more than 64 characters. + */ + @JsonProperty(value = "id") + private String id; + + /** + * A display name for the task. + * The display name need not be unique and can contain any Unicode + * characters up to a maximum length of 1024. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The URL of the task. + */ + @JsonProperty(value = "url") + private String url; + + /** + * The ETag of the task. + * This is an opaque string. You can use it to detect whether the task has + * changed between requests. In particular, you can be pass the ETag when + * updating a task to specify that your changes should take effect only if + * nobody else has modified the task in the meantime. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * The last modified time of the task. + */ + @JsonProperty(value = "lastModified") + private DateTime lastModified; + + /** + * The creation time of the task. + */ + @JsonProperty(value = "creationTime") + private DateTime creationTime; + + /** + * How the Batch service should respond when the task completes. + */ + @JsonProperty(value = "exitConditions") + private ExitConditions exitConditions; + + /** + * The current state of the task. + * Possible values include: 'active', 'preparing', 'running', 'completed'. + */ + @JsonProperty(value = "state") + private TaskState state; + + /** + * The time at which the task entered its current state. + */ + @JsonProperty(value = "stateTransitionTime") + private DateTime stateTransitionTime; + + /** + * The previous state of the task. + * This property is not set if the task is in its initial Active state. + * Possible values include: 'active', 'preparing', 'running', 'completed'. + */ + @JsonProperty(value = "previousState") + private TaskState previousState; + + /** + * The time at which the task entered its previous state. + * This property is not set if the task is in its initial Active state. + */ + @JsonProperty(value = "previousStateTransitionTime") + private DateTime previousStateTransitionTime; + + /** + * The command line of the task. + * For multi-instance tasks, the command line is executed as the primary + * task, after the primary task and all subtasks have finished executing + * the coordination command line. The command line does not run under a + * shell, and therefore cannot take advantage of shell features such as + * environment variable expansion. If you want to take advantage of such + * features, you should invoke the shell in the command line, for example + * using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. + * If the command line refers to file paths, it should use a relative path + * (relative to the task working directory), or use the Batch provided + * environment variable + * (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + */ + @JsonProperty(value = "commandLine") + private String commandLine; + + /** + * The settings for the container under which the task runs. + * If the pool that will run this task has containerConfiguration set, this + * must be set as well. If the pool that will run this task doesn't have + * containerConfiguration set, this must not be set. When this is + * specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR + * (the root of Azure Batch directories on the node) are mapped into the + * container, all task environment variables are mapped into the container, + * and the task command line is executed in the container. + */ + @JsonProperty(value = "containerSettings") + private TaskContainerSettings containerSettings; + + /** + * A list of files that the Batch service will download to the compute node + * before running the command line. + * For multi-instance tasks, the resource files will only be downloaded to + * the compute node on which the primary task is executed. There is a + * maximum size for the list of resource files. When the max size is + * exceeded, the request will fail and the response error code will be + * RequestEntityTooLarge. If this occurs, the collection of ResourceFiles + * must be reduced in size. This can be achieved using .zip files, + * Application Packages, or Docker Containers. + */ + @JsonProperty(value = "resourceFiles") + private List resourceFiles; + + /** + * A list of files that the Batch service will upload from the compute node + * after running the command line. + * For multi-instance tasks, the files will only be uploaded from the + * compute node on which the primary task is executed. + */ + @JsonProperty(value = "outputFiles") + private List outputFiles; + + /** + * A list of environment variable settings for the task. + */ + @JsonProperty(value = "environmentSettings") + private List environmentSettings; + + /** + * A locality hint that can be used by the Batch service to select a + * compute node on which to start the new task. + */ + @JsonProperty(value = "affinityInfo") + private AffinityInformation affinityInfo; + + /** + * The execution constraints that apply to this task. + */ + @JsonProperty(value = "constraints") + private TaskConstraints constraints; + + /** + * The user identity under which the task runs. + * If omitted, the task runs as a non-administrative user unique to the + * task. + */ + @JsonProperty(value = "userIdentity") + private UserIdentity userIdentity; + + /** + * Information about the execution of the task. + */ + @JsonProperty(value = "executionInfo") + private TaskExecutionInformation executionInfo; + + /** + * Information about the compute node on which the task ran. + */ + @JsonProperty(value = "nodeInfo") + private ComputeNodeInformation nodeInfo; + + /** + * An object that indicates that the task is a multi-instance task, and + * contains information about how to run the multi-instance task. + */ + @JsonProperty(value = "multiInstanceSettings") + private MultiInstanceSettings multiInstanceSettings; + + /** + * Resource usage statistics for the task. + */ + @JsonProperty(value = "stats") + private TaskStatistics stats; + + /** + * The tasks that this task depends on. + * This task will not be scheduled until all tasks that it depends on have + * completed successfully. If any of those tasks fail and exhaust their + * retry counts, this task will never be scheduled. + */ + @JsonProperty(value = "dependsOn") + private TaskDependencies dependsOn; + + /** + * A list of application packages that the Batch service will deploy to the + * compute node before running the command line. + * Application packages are downloaded and deployed to a shared directory, + * not the task working directory. Therefore, if a referenced package is + * already on the compute node, and is up to date, then it is not + * re-downloaded; the existing copy on the compute node is used. If a + * referenced application package cannot be installed, for example because + * the package has been deleted or because download failed, the task fails. + */ + @JsonProperty(value = "applicationPackageReferences") + private List applicationPackageReferences; + + /** + * The settings for an authentication token that the task can use to + * perform Batch service operations. + * If this property is set, the Batch service provides the task with an + * authentication token which can be used to authenticate Batch service + * operations without requiring an account access key. The token is + * provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The + * operations that the task can carry out using the token depend on the + * settings. For example, a task can request job permissions in order to + * add other tasks to the job, or check the status of the job or of other + * tasks under the job. + */ + @JsonProperty(value = "authenticationTokenSettings") + private AuthenticationTokenSettings authenticationTokenSettings; + + /** + * Get the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. + * + * @param id the id value to set + * @return the CloudTask object itself. + */ + public CloudTask withId(String id) { + this.id = id; + return this; + } + + /** + * Get the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @param displayName the displayName value to set + * @return the CloudTask object itself. + */ + public CloudTask withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the CloudTask object itself. + */ + public CloudTask withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get this is an opaque string. You can use it to detect whether the task has changed between requests. In particular, you can be pass the ETag when updating a task to specify that your changes should take effect only if nobody else has modified the task in the meantime. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set this is an opaque string. You can use it to detect whether the task has changed between requests. In particular, you can be pass the ETag when updating a task to specify that your changes should take effect only if nobody else has modified the task in the meantime. + * + * @param eTag the eTag value to set + * @return the CloudTask object itself. + */ + public CloudTask withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified value. + * + * @return the lastModified value + */ + public DateTime lastModified() { + return this.lastModified; + } + + /** + * Set the lastModified value. + * + * @param lastModified the lastModified value to set + * @return the CloudTask object itself. + */ + public CloudTask withLastModified(DateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * Get the creationTime value. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + + /** + * Set the creationTime value. + * + * @param creationTime the creationTime value to set + * @return the CloudTask object itself. + */ + public CloudTask withCreationTime(DateTime creationTime) { + this.creationTime = creationTime; + return this; + } + + /** + * Get how the Batch service should respond when the task completes. + * + * @return the exitConditions value + */ + public ExitConditions exitConditions() { + return this.exitConditions; + } + + /** + * Set how the Batch service should respond when the task completes. + * + * @param exitConditions the exitConditions value to set + * @return the CloudTask object itself. + */ + public CloudTask withExitConditions(ExitConditions exitConditions) { + this.exitConditions = exitConditions; + return this; + } + + /** + * Get possible values include: 'active', 'preparing', 'running', 'completed'. + * + * @return the state value + */ + public TaskState state() { + return this.state; + } + + /** + * Set possible values include: 'active', 'preparing', 'running', 'completed'. + * + * @param state the state value to set + * @return the CloudTask object itself. + */ + public CloudTask withState(TaskState state) { + this.state = state; + return this; + } + + /** + * Get the stateTransitionTime value. + * + * @return the stateTransitionTime value + */ + public DateTime stateTransitionTime() { + return this.stateTransitionTime; + } + + /** + * Set the stateTransitionTime value. + * + * @param stateTransitionTime the stateTransitionTime value to set + * @return the CloudTask object itself. + */ + public CloudTask withStateTransitionTime(DateTime stateTransitionTime) { + this.stateTransitionTime = stateTransitionTime; + return this; + } + + /** + * Get this property is not set if the task is in its initial Active state. Possible values include: 'active', 'preparing', 'running', 'completed'. + * + * @return the previousState value + */ + public TaskState previousState() { + return this.previousState; + } + + /** + * Set this property is not set if the task is in its initial Active state. Possible values include: 'active', 'preparing', 'running', 'completed'. + * + * @param previousState the previousState value to set + * @return the CloudTask object itself. + */ + public CloudTask withPreviousState(TaskState previousState) { + this.previousState = previousState; + return this; + } + + /** + * Get this property is not set if the task is in its initial Active state. + * + * @return the previousStateTransitionTime value + */ + public DateTime previousStateTransitionTime() { + return this.previousStateTransitionTime; + } + + /** + * Set this property is not set if the task is in its initial Active state. + * + * @param previousStateTransitionTime the previousStateTransitionTime value to set + * @return the CloudTask object itself. + */ + public CloudTask withPreviousStateTransitionTime(DateTime previousStateTransitionTime) { + this.previousStateTransitionTime = previousStateTransitionTime; + return this; + } + + /** + * Get for multi-instance tasks, the command line is executed as the primary task, after the primary task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @return the commandLine value + */ + public String commandLine() { + return this.commandLine; + } + + /** + * Set for multi-instance tasks, the command line is executed as the primary task, after the primary task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @param commandLine the commandLine value to set + * @return the CloudTask object itself. + */ + public CloudTask withCommandLine(String commandLine) { + this.commandLine = commandLine; + return this; + } + + /** + * Get if the pool that will run this task has containerConfiguration set, this must be set as well. If the pool that will run this task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @return the containerSettings value + */ + public TaskContainerSettings containerSettings() { + return this.containerSettings; + } + + /** + * Set if the pool that will run this task has containerConfiguration set, this must be set as well. If the pool that will run this task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @param containerSettings the containerSettings value to set + * @return the CloudTask object itself. + */ + public CloudTask withContainerSettings(TaskContainerSettings containerSettings) { + this.containerSettings = containerSettings; + return this; + } + + /** + * Get for multi-instance tasks, the resource files will only be downloaded to the compute node on which the primary task is executed. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + * + * @return the resourceFiles value + */ + public List resourceFiles() { + return this.resourceFiles; + } + + /** + * Set for multi-instance tasks, the resource files will only be downloaded to the compute node on which the primary task is executed. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + * + * @param resourceFiles the resourceFiles value to set + * @return the CloudTask object itself. + */ + public CloudTask withResourceFiles(List resourceFiles) { + this.resourceFiles = resourceFiles; + return this; + } + + /** + * Get for multi-instance tasks, the files will only be uploaded from the compute node on which the primary task is executed. + * + * @return the outputFiles value + */ + public List outputFiles() { + return this.outputFiles; + } + + /** + * Set for multi-instance tasks, the files will only be uploaded from the compute node on which the primary task is executed. + * + * @param outputFiles the outputFiles value to set + * @return the CloudTask object itself. + */ + public CloudTask withOutputFiles(List outputFiles) { + this.outputFiles = outputFiles; + return this; + } + + /** + * Get the environmentSettings value. + * + * @return the environmentSettings value + */ + public List environmentSettings() { + return this.environmentSettings; + } + + /** + * Set the environmentSettings value. + * + * @param environmentSettings the environmentSettings value to set + * @return the CloudTask object itself. + */ + public CloudTask withEnvironmentSettings(List environmentSettings) { + this.environmentSettings = environmentSettings; + return this; + } + + /** + * Get the affinityInfo value. + * + * @return the affinityInfo value + */ + public AffinityInformation affinityInfo() { + return this.affinityInfo; + } + + /** + * Set the affinityInfo value. + * + * @param affinityInfo the affinityInfo value to set + * @return the CloudTask object itself. + */ + public CloudTask withAffinityInfo(AffinityInformation affinityInfo) { + this.affinityInfo = affinityInfo; + return this; + } + + /** + * Get the constraints value. + * + * @return the constraints value + */ + public TaskConstraints constraints() { + return this.constraints; + } + + /** + * Set the constraints value. + * + * @param constraints the constraints value to set + * @return the CloudTask object itself. + */ + public CloudTask withConstraints(TaskConstraints constraints) { + this.constraints = constraints; + return this; + } + + /** + * Get if omitted, the task runs as a non-administrative user unique to the task. + * + * @return the userIdentity value + */ + public UserIdentity userIdentity() { + return this.userIdentity; + } + + /** + * Set if omitted, the task runs as a non-administrative user unique to the task. + * + * @param userIdentity the userIdentity value to set + * @return the CloudTask object itself. + */ + public CloudTask withUserIdentity(UserIdentity userIdentity) { + this.userIdentity = userIdentity; + return this; + } + + /** + * Get the executionInfo value. + * + * @return the executionInfo value + */ + public TaskExecutionInformation executionInfo() { + return this.executionInfo; + } + + /** + * Set the executionInfo value. + * + * @param executionInfo the executionInfo value to set + * @return the CloudTask object itself. + */ + public CloudTask withExecutionInfo(TaskExecutionInformation executionInfo) { + this.executionInfo = executionInfo; + return this; + } + + /** + * Get the nodeInfo value. + * + * @return the nodeInfo value + */ + public ComputeNodeInformation nodeInfo() { + return this.nodeInfo; + } + + /** + * Set the nodeInfo value. + * + * @param nodeInfo the nodeInfo value to set + * @return the CloudTask object itself. + */ + public CloudTask withNodeInfo(ComputeNodeInformation nodeInfo) { + this.nodeInfo = nodeInfo; + return this; + } + + /** + * Get the multiInstanceSettings value. + * + * @return the multiInstanceSettings value + */ + public MultiInstanceSettings multiInstanceSettings() { + return this.multiInstanceSettings; + } + + /** + * Set the multiInstanceSettings value. + * + * @param multiInstanceSettings the multiInstanceSettings value to set + * @return the CloudTask object itself. + */ + public CloudTask withMultiInstanceSettings(MultiInstanceSettings multiInstanceSettings) { + this.multiInstanceSettings = multiInstanceSettings; + return this; + } + + /** + * Get the stats value. + * + * @return the stats value + */ + public TaskStatistics stats() { + return this.stats; + } + + /** + * Set the stats value. + * + * @param stats the stats value to set + * @return the CloudTask object itself. + */ + public CloudTask withStats(TaskStatistics stats) { + this.stats = stats; + return this; + } + + /** + * Get this task will not be scheduled until all tasks that it depends on have completed successfully. If any of those tasks fail and exhaust their retry counts, this task will never be scheduled. + * + * @return the dependsOn value + */ + public TaskDependencies dependsOn() { + return this.dependsOn; + } + + /** + * Set this task will not be scheduled until all tasks that it depends on have completed successfully. If any of those tasks fail and exhaust their retry counts, this task will never be scheduled. + * + * @param dependsOn the dependsOn value to set + * @return the CloudTask object itself. + */ + public CloudTask withDependsOn(TaskDependencies dependsOn) { + this.dependsOn = dependsOn; + return this; + } + + /** + * Get application packages are downloaded and deployed to a shared directory, not the task working directory. Therefore, if a referenced package is already on the compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application package cannot be installed, for example because the package has been deleted or because download failed, the task fails. + * + * @return the applicationPackageReferences value + */ + public List applicationPackageReferences() { + return this.applicationPackageReferences; + } + + /** + * Set application packages are downloaded and deployed to a shared directory, not the task working directory. Therefore, if a referenced package is already on the compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application package cannot be installed, for example because the package has been deleted or because download failed, the task fails. + * + * @param applicationPackageReferences the applicationPackageReferences value to set + * @return the CloudTask object itself. + */ + public CloudTask withApplicationPackageReferences(List applicationPackageReferences) { + this.applicationPackageReferences = applicationPackageReferences; + return this; + } + + /** + * Get if this property is set, the Batch service provides the task with an authentication token which can be used to authenticate Batch service operations without requiring an account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the task can carry out using the token depend on the settings. For example, a task can request job permissions in order to add other tasks to the job, or check the status of the job or of other tasks under the job. + * + * @return the authenticationTokenSettings value + */ + public AuthenticationTokenSettings authenticationTokenSettings() { + return this.authenticationTokenSettings; + } + + /** + * Set if this property is set, the Batch service provides the task with an authentication token which can be used to authenticate Batch service operations without requiring an account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the task can carry out using the token depend on the settings. For example, a task can request job permissions in order to add other tasks to the job, or check the status of the job or of other tasks under the job. + * + * @param authenticationTokenSettings the authenticationTokenSettings value to set + * @return the CloudTask object itself. + */ + public CloudTask withAuthenticationTokenSettings(AuthenticationTokenSettings authenticationTokenSettings) { + this.authenticationTokenSettings = authenticationTokenSettings; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudTaskListSubtasksResult.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudTaskListSubtasksResult.java new file mode 100644 index 000000000000..c2073366dacc --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/CloudTaskListSubtasksResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result of listing the subtasks of a task. + */ +public class CloudTaskListSubtasksResult { + /** + * The list of subtasks. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value value. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the CloudTaskListSubtasksResult object itself. + */ + public CloudTaskListSubtasksResult withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNode.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNode.java new file mode 100644 index 000000000000..7c643b597fa4 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNode.java @@ -0,0 +1,607 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A compute node in the Batch service. + */ +public class ComputeNode { + /** + * The ID of the compute node. + * Every node that is added to a pool is assigned a unique ID. Whenever a + * node is removed from a pool, all of its local files are deleted, and the + * ID is reclaimed and could be reused for new nodes. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The URL of the compute node. + */ + @JsonProperty(value = "url") + private String url; + + /** + * The current state of the compute node. + * The low-priority node has been preempted. Tasks which were running on + * the node when it was pre-empted will be rescheduled when another node + * becomes available. Possible values include: 'idle', 'rebooting', + * 'reimaging', 'running', 'unusable', 'creating', 'starting', + * 'waitingForStartTask', 'startTaskFailed', 'unknown', 'leavingPool', + * 'offline', 'preempted'. + */ + @JsonProperty(value = "state") + private ComputeNodeState state; + + /** + * Whether the compute node is available for task scheduling. + * Possible values include: 'enabled', 'disabled'. + */ + @JsonProperty(value = "schedulingState") + private SchedulingState schedulingState; + + /** + * The time at which the compute node entered its current state. + */ + @JsonProperty(value = "stateTransitionTime") + private DateTime stateTransitionTime; + + /** + * The last time at which the compute node was started. + * This property may not be present if the node state is unusable. + */ + @JsonProperty(value = "lastBootTime") + private DateTime lastBootTime; + + /** + * The time at which this compute node was allocated to the pool. + * This is the time when the node was initially allocated and doesn't + * change once set. It is not updated when the node is service healed or + * preempted. + */ + @JsonProperty(value = "allocationTime") + private DateTime allocationTime; + + /** + * The IP address that other compute nodes can use to communicate with this + * compute node. + * Every node that is added to a pool is assigned a unique IP address. + * Whenever a node is removed from a pool, all of its local files are + * deleted, and the IP address is reclaimed and could be reused for new + * nodes. + */ + @JsonProperty(value = "ipAddress") + private String ipAddress; + + /** + * An identifier which can be passed when adding a task to request that the + * task be scheduled on this node. + * Note that this is just a soft affinity. If the target node is busy or + * unavailable at the time the task is scheduled, then the task will be + * scheduled elsewhere. + */ + @JsonProperty(value = "affinityId") + private String affinityId; + + /** + * The size of the virtual machine hosting the compute node. + * For information about available sizes of virtual machines in pools, see + * Choose a VM size for compute nodes in an Azure Batch pool + * (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + */ + @JsonProperty(value = "vmSize") + private String vmSize; + + /** + * The total number of job tasks completed on the compute node. This + * includes Job Manager tasks and normal tasks, but not Job Preparation, + * Job Release or Start tasks. + */ + @JsonProperty(value = "totalTasksRun") + private Integer totalTasksRun; + + /** + * The total number of currently running job tasks on the compute node. + * This includes Job Manager tasks and normal tasks, but not Job + * Preparation, Job Release or Start tasks. + */ + @JsonProperty(value = "runningTasksCount") + private Integer runningTasksCount; + + /** + * The total number of job tasks which completed successfully (with + * exitCode 0) on the compute node. This includes Job Manager tasks and + * normal tasks, but not Job Preparation, Job Release or Start tasks. + */ + @JsonProperty(value = "totalTasksSucceeded") + private Integer totalTasksSucceeded; + + /** + * A list of tasks whose state has recently changed. + * This property is present only if at least one task has run on this node + * since it was assigned to the pool. + */ + @JsonProperty(value = "recentTasks") + private List recentTasks; + + /** + * The task specified to run on the compute node as it joins the pool. + */ + @JsonProperty(value = "startTask") + private StartTask startTask; + + /** + * Runtime information about the execution of the start task on the compute + * node. + */ + @JsonProperty(value = "startTaskInfo") + private StartTaskInformation startTaskInfo; + + /** + * The list of certificates installed on the compute node. + * For Windows compute nodes, the Batch service installs the certificates + * to the specified certificate store and location. For Linux compute + * nodes, the certificates are stored in a directory inside the task + * working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR + * is supplied to the task to query for this location. For certificates + * with visibility of 'remoteUser', a 'certs' directory is created in the + * user's home directory (e.g., /home/{user-name}/certs) and certificates + * are placed in that directory. + */ + @JsonProperty(value = "certificateReferences") + private List certificateReferences; + + /** + * The list of errors that are currently being encountered by the compute + * node. + */ + @JsonProperty(value = "errors") + private List errors; + + /** + * Whether this compute node is a dedicated node. If false, the node is a + * low-priority node. + */ + @JsonProperty(value = "isDedicated") + private Boolean isDedicated; + + /** + * The endpoint configuration for the compute node. + */ + @JsonProperty(value = "endpointConfiguration") + private ComputeNodeEndpointConfiguration endpointConfiguration; + + /** + * Information about the node agent version and the time the node upgraded + * to a new version. + */ + @JsonProperty(value = "nodeAgentInfo") + private NodeAgentInformation nodeAgentInfo; + + /** + * Get every node that is added to a pool is assigned a unique ID. Whenever a node is removed from a pool, all of its local files are deleted, and the ID is reclaimed and could be reused for new nodes. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set every node that is added to a pool is assigned a unique ID. Whenever a node is removed from a pool, all of its local files are deleted, and the ID is reclaimed and could be reused for new nodes. + * + * @param id the id value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withId(String id) { + this.id = id; + return this; + } + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the low-priority node has been preempted. Tasks which were running on the node when it was pre-empted will be rescheduled when another node becomes available. Possible values include: 'idle', 'rebooting', 'reimaging', 'running', 'unusable', 'creating', 'starting', 'waitingForStartTask', 'startTaskFailed', 'unknown', 'leavingPool', 'offline', 'preempted'. + * + * @return the state value + */ + public ComputeNodeState state() { + return this.state; + } + + /** + * Set the low-priority node has been preempted. Tasks which were running on the node when it was pre-empted will be rescheduled when another node becomes available. Possible values include: 'idle', 'rebooting', 'reimaging', 'running', 'unusable', 'creating', 'starting', 'waitingForStartTask', 'startTaskFailed', 'unknown', 'leavingPool', 'offline', 'preempted'. + * + * @param state the state value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withState(ComputeNodeState state) { + this.state = state; + return this; + } + + /** + * Get possible values include: 'enabled', 'disabled'. + * + * @return the schedulingState value + */ + public SchedulingState schedulingState() { + return this.schedulingState; + } + + /** + * Set possible values include: 'enabled', 'disabled'. + * + * @param schedulingState the schedulingState value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withSchedulingState(SchedulingState schedulingState) { + this.schedulingState = schedulingState; + return this; + } + + /** + * Get the stateTransitionTime value. + * + * @return the stateTransitionTime value + */ + public DateTime stateTransitionTime() { + return this.stateTransitionTime; + } + + /** + * Set the stateTransitionTime value. + * + * @param stateTransitionTime the stateTransitionTime value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withStateTransitionTime(DateTime stateTransitionTime) { + this.stateTransitionTime = stateTransitionTime; + return this; + } + + /** + * Get this property may not be present if the node state is unusable. + * + * @return the lastBootTime value + */ + public DateTime lastBootTime() { + return this.lastBootTime; + } + + /** + * Set this property may not be present if the node state is unusable. + * + * @param lastBootTime the lastBootTime value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withLastBootTime(DateTime lastBootTime) { + this.lastBootTime = lastBootTime; + return this; + } + + /** + * Get this is the time when the node was initially allocated and doesn't change once set. It is not updated when the node is service healed or preempted. + * + * @return the allocationTime value + */ + public DateTime allocationTime() { + return this.allocationTime; + } + + /** + * Set this is the time when the node was initially allocated and doesn't change once set. It is not updated when the node is service healed or preempted. + * + * @param allocationTime the allocationTime value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withAllocationTime(DateTime allocationTime) { + this.allocationTime = allocationTime; + return this; + } + + /** + * Get every node that is added to a pool is assigned a unique IP address. Whenever a node is removed from a pool, all of its local files are deleted, and the IP address is reclaimed and could be reused for new nodes. + * + * @return the ipAddress value + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Set every node that is added to a pool is assigned a unique IP address. Whenever a node is removed from a pool, all of its local files are deleted, and the IP address is reclaimed and could be reused for new nodes. + * + * @param ipAddress the ipAddress value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * Get note that this is just a soft affinity. If the target node is busy or unavailable at the time the task is scheduled, then the task will be scheduled elsewhere. + * + * @return the affinityId value + */ + public String affinityId() { + return this.affinityId; + } + + /** + * Set note that this is just a soft affinity. If the target node is busy or unavailable at the time the task is scheduled, then the task will be scheduled elsewhere. + * + * @param affinityId the affinityId value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withAffinityId(String affinityId) { + this.affinityId = affinityId; + return this; + } + + /** + * Get for information about available sizes of virtual machines in pools, see Choose a VM size for compute nodes in an Azure Batch pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + * + * @return the vmSize value + */ + public String vmSize() { + return this.vmSize; + } + + /** + * Set for information about available sizes of virtual machines in pools, see Choose a VM size for compute nodes in an Azure Batch pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + * + * @param vmSize the vmSize value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withVmSize(String vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get the totalTasksRun value. + * + * @return the totalTasksRun value + */ + public Integer totalTasksRun() { + return this.totalTasksRun; + } + + /** + * Set the totalTasksRun value. + * + * @param totalTasksRun the totalTasksRun value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withTotalTasksRun(Integer totalTasksRun) { + this.totalTasksRun = totalTasksRun; + return this; + } + + /** + * Get the runningTasksCount value. + * + * @return the runningTasksCount value + */ + public Integer runningTasksCount() { + return this.runningTasksCount; + } + + /** + * Set the runningTasksCount value. + * + * @param runningTasksCount the runningTasksCount value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withRunningTasksCount(Integer runningTasksCount) { + this.runningTasksCount = runningTasksCount; + return this; + } + + /** + * Get the totalTasksSucceeded value. + * + * @return the totalTasksSucceeded value + */ + public Integer totalTasksSucceeded() { + return this.totalTasksSucceeded; + } + + /** + * Set the totalTasksSucceeded value. + * + * @param totalTasksSucceeded the totalTasksSucceeded value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withTotalTasksSucceeded(Integer totalTasksSucceeded) { + this.totalTasksSucceeded = totalTasksSucceeded; + return this; + } + + /** + * Get this property is present only if at least one task has run on this node since it was assigned to the pool. + * + * @return the recentTasks value + */ + public List recentTasks() { + return this.recentTasks; + } + + /** + * Set this property is present only if at least one task has run on this node since it was assigned to the pool. + * + * @param recentTasks the recentTasks value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withRecentTasks(List recentTasks) { + this.recentTasks = recentTasks; + return this; + } + + /** + * Get the startTask value. + * + * @return the startTask value + */ + public StartTask startTask() { + return this.startTask; + } + + /** + * Set the startTask value. + * + * @param startTask the startTask value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withStartTask(StartTask startTask) { + this.startTask = startTask; + return this; + } + + /** + * Get the startTaskInfo value. + * + * @return the startTaskInfo value + */ + public StartTaskInformation startTaskInfo() { + return this.startTaskInfo; + } + + /** + * Set the startTaskInfo value. + * + * @param startTaskInfo the startTaskInfo value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withStartTaskInfo(StartTaskInformation startTaskInfo) { + this.startTaskInfo = startTaskInfo; + return this; + } + + /** + * Get for Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @return the certificateReferences value + */ + public List certificateReferences() { + return this.certificateReferences; + } + + /** + * Set for Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @param certificateReferences the certificateReferences value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withCertificateReferences(List certificateReferences) { + this.certificateReferences = certificateReferences; + return this; + } + + /** + * Get the errors value. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + + /** + * Set the errors value. + * + * @param errors the errors value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Get the isDedicated value. + * + * @return the isDedicated value + */ + public Boolean isDedicated() { + return this.isDedicated; + } + + /** + * Set the isDedicated value. + * + * @param isDedicated the isDedicated value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withIsDedicated(Boolean isDedicated) { + this.isDedicated = isDedicated; + return this; + } + + /** + * Get the endpointConfiguration value. + * + * @return the endpointConfiguration value + */ + public ComputeNodeEndpointConfiguration endpointConfiguration() { + return this.endpointConfiguration; + } + + /** + * Set the endpointConfiguration value. + * + * @param endpointConfiguration the endpointConfiguration value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withEndpointConfiguration(ComputeNodeEndpointConfiguration endpointConfiguration) { + this.endpointConfiguration = endpointConfiguration; + return this; + } + + /** + * Get the nodeAgentInfo value. + * + * @return the nodeAgentInfo value + */ + public NodeAgentInformation nodeAgentInfo() { + return this.nodeAgentInfo; + } + + /** + * Set the nodeAgentInfo value. + * + * @param nodeAgentInfo the nodeAgentInfo value to set + * @return the ComputeNode object itself. + */ + public ComputeNode withNodeAgentInfo(NodeAgentInformation nodeAgentInfo) { + this.nodeAgentInfo = nodeAgentInfo; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeAddUserHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeAddUserHeaders.java new file mode 100644 index 000000000000..a94893df8204 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeAddUserHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for AddUser operation. + */ +public class ComputeNodeAddUserHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeAddUserHeaders object itself. + */ + public ComputeNodeAddUserHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeAddUserHeaders object itself. + */ + public ComputeNodeAddUserHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ComputeNodeAddUserHeaders object itself. + */ + public ComputeNodeAddUserHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ComputeNodeAddUserHeaders object itself. + */ + public ComputeNodeAddUserHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the ComputeNodeAddUserHeaders object itself. + */ + public ComputeNodeAddUserHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeAddUserOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeAddUserOptions.java new file mode 100644 index 000000000000..0cd6a7116da4 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeAddUserOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for addUser operation. + */ +public class ComputeNodeAddUserOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeAddUserOptions object itself. + */ + public ComputeNodeAddUserOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeAddUserOptions object itself. + */ + public ComputeNodeAddUserOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeAddUserOptions object itself. + */ + public ComputeNodeAddUserOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeAddUserOptions object itself. + */ + public ComputeNodeAddUserOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDeallocationOption.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDeallocationOption.java new file mode 100644 index 000000000000..95cec10d29da --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDeallocationOption.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ComputeNodeDeallocationOption. + */ +public enum ComputeNodeDeallocationOption { + /** Terminate running task processes and requeue the tasks. The tasks will run again when a node is available. Remove nodes as soon as tasks have been terminated. */ + REQUEUE("requeue"), + + /** Terminate running tasks. The tasks will be completed with failureInfo indicating that they were terminated, and will not run again. Remove nodes as soon as tasks have been terminated. */ + TERMINATE("terminate"), + + /** Allow currently running tasks to complete. Schedule no new tasks while waiting. Remove nodes when all tasks have completed. */ + TASK_COMPLETION("taskcompletion"), + + /** Allow currently running tasks to complete, then wait for all task data retention periods to expire. Schedule no new tasks while waiting. Remove nodes when all task retention periods have expired. */ + RETAINED_DATA("retaineddata"); + + /** The actual serialized value for a ComputeNodeDeallocationOption instance. */ + private String value; + + ComputeNodeDeallocationOption(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ComputeNodeDeallocationOption instance. + * + * @param value the serialized value to parse. + * @return the parsed ComputeNodeDeallocationOption object, or null if unable to parse. + */ + @JsonCreator + public static ComputeNodeDeallocationOption fromString(String value) { + ComputeNodeDeallocationOption[] items = ComputeNodeDeallocationOption.values(); + for (ComputeNodeDeallocationOption item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDeleteUserHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDeleteUserHeaders.java new file mode 100644 index 000000000000..99505c088c50 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDeleteUserHeaders.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for DeleteUser operation. + */ +public class ComputeNodeDeleteUserHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private String clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private String requestId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeDeleteUserHeaders object itself. + */ + public ComputeNodeDeleteUserHeaders withClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeDeleteUserHeaders object itself. + */ + public ComputeNodeDeleteUserHeaders withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDeleteUserOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDeleteUserOptions.java new file mode 100644 index 000000000000..7ecad688efc5 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDeleteUserOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for deleteUser operation. + */ +public class ComputeNodeDeleteUserOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeDeleteUserOptions object itself. + */ + public ComputeNodeDeleteUserOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeDeleteUserOptions object itself. + */ + public ComputeNodeDeleteUserOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeDeleteUserOptions object itself. + */ + public ComputeNodeDeleteUserOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeDeleteUserOptions object itself. + */ + public ComputeNodeDeleteUserOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDisableSchedulingHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDisableSchedulingHeaders.java new file mode 100644 index 000000000000..db677bc54d4e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDisableSchedulingHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for DisableScheduling operation. + */ +public class ComputeNodeDisableSchedulingHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeDisableSchedulingHeaders object itself. + */ + public ComputeNodeDisableSchedulingHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeDisableSchedulingHeaders object itself. + */ + public ComputeNodeDisableSchedulingHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ComputeNodeDisableSchedulingHeaders object itself. + */ + public ComputeNodeDisableSchedulingHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ComputeNodeDisableSchedulingHeaders object itself. + */ + public ComputeNodeDisableSchedulingHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the ComputeNodeDisableSchedulingHeaders object itself. + */ + public ComputeNodeDisableSchedulingHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDisableSchedulingOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDisableSchedulingOptions.java new file mode 100644 index 000000000000..2bbf7bcf68e0 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeDisableSchedulingOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for disableScheduling operation. + */ +public class ComputeNodeDisableSchedulingOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeDisableSchedulingOptions object itself. + */ + public ComputeNodeDisableSchedulingOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeDisableSchedulingOptions object itself. + */ + public ComputeNodeDisableSchedulingOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeDisableSchedulingOptions object itself. + */ + public ComputeNodeDisableSchedulingOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeDisableSchedulingOptions object itself. + */ + public ComputeNodeDisableSchedulingOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeEnableSchedulingHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeEnableSchedulingHeaders.java new file mode 100644 index 000000000000..c42cdcbb5388 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeEnableSchedulingHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for EnableScheduling operation. + */ +public class ComputeNodeEnableSchedulingHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeEnableSchedulingHeaders object itself. + */ + public ComputeNodeEnableSchedulingHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeEnableSchedulingHeaders object itself. + */ + public ComputeNodeEnableSchedulingHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ComputeNodeEnableSchedulingHeaders object itself. + */ + public ComputeNodeEnableSchedulingHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ComputeNodeEnableSchedulingHeaders object itself. + */ + public ComputeNodeEnableSchedulingHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the ComputeNodeEnableSchedulingHeaders object itself. + */ + public ComputeNodeEnableSchedulingHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeEnableSchedulingOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeEnableSchedulingOptions.java new file mode 100644 index 000000000000..6489c70f5daf --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeEnableSchedulingOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for enableScheduling operation. + */ +public class ComputeNodeEnableSchedulingOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeEnableSchedulingOptions object itself. + */ + public ComputeNodeEnableSchedulingOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeEnableSchedulingOptions object itself. + */ + public ComputeNodeEnableSchedulingOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeEnableSchedulingOptions object itself. + */ + public ComputeNodeEnableSchedulingOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeEnableSchedulingOptions object itself. + */ + public ComputeNodeEnableSchedulingOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeEndpointConfiguration.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeEndpointConfiguration.java new file mode 100644 index 000000000000..891cf64fa4ce --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeEndpointConfiguration.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The endpoint configuration for the compute node. + */ +public class ComputeNodeEndpointConfiguration { + /** + * The list of inbound endpoints that are accessible on the compute node. + */ + @JsonProperty(value = "inboundEndpoints", required = true) + private List inboundEndpoints; + + /** + * Get the inboundEndpoints value. + * + * @return the inboundEndpoints value + */ + public List inboundEndpoints() { + return this.inboundEndpoints; + } + + /** + * Set the inboundEndpoints value. + * + * @param inboundEndpoints the inboundEndpoints value to set + * @return the ComputeNodeEndpointConfiguration object itself. + */ + public ComputeNodeEndpointConfiguration withInboundEndpoints(List inboundEndpoints) { + this.inboundEndpoints = inboundEndpoints; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeError.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeError.java new file mode 100644 index 000000000000..145c487a067f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeError.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error encountered by a compute node. + */ +public class ComputeNodeError { + /** + * An identifier for the compute node error. Codes are invariant and are + * intended to be consumed programmatically. + */ + @JsonProperty(value = "code") + private String code; + + /** + * A message describing the compute node error, intended to be suitable for + * display in a user interface. + */ + @JsonProperty(value = "message") + private String message; + + /** + * The list of additional error details related to the compute node error. + */ + @JsonProperty(value = "errorDetails") + private List errorDetails; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the ComputeNodeError object itself. + */ + public ComputeNodeError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the ComputeNodeError object itself. + */ + public ComputeNodeError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the errorDetails value. + * + * @return the errorDetails value + */ + public List errorDetails() { + return this.errorDetails; + } + + /** + * Set the errorDetails value. + * + * @param errorDetails the errorDetails value to set + * @return the ComputeNodeError object itself. + */ + public ComputeNodeError withErrorDetails(List errorDetails) { + this.errorDetails = errorDetails; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeFillType.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeFillType.java new file mode 100644 index 000000000000..0ea2521c6ffb --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeFillType.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ComputeNodeFillType. + */ +public enum ComputeNodeFillType { + /** Tasks should be assigned evenly across all nodes in the pool. */ + SPREAD("spread"), + + /** As many tasks as possible (maxTasksPerNode) should be assigned to each node in the pool before any tasks are assigned to the next node in the pool. */ + PACK("pack"); + + /** The actual serialized value for a ComputeNodeFillType instance. */ + private String value; + + ComputeNodeFillType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ComputeNodeFillType instance. + * + * @param value the serialized value to parse. + * @return the parsed ComputeNodeFillType object, or null if unable to parse. + */ + @JsonCreator + public static ComputeNodeFillType fromString(String value) { + ComputeNodeFillType[] items = ComputeNodeFillType.values(); + for (ComputeNodeFillType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetHeaders.java new file mode 100644 index 000000000000..2b83a08b2042 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ComputeNodeGetHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeGetHeaders object itself. + */ + public ComputeNodeGetHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeGetHeaders object itself. + */ + public ComputeNodeGetHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ComputeNodeGetHeaders object itself. + */ + public ComputeNodeGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ComputeNodeGetHeaders object itself. + */ + public ComputeNodeGetHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetOptions.java new file mode 100644 index 000000000000..5e057d1e2009 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetOptions.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for get operation. + */ +public class ComputeNodeGetOptions { + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the ComputeNodeGetOptions object itself. + */ + public ComputeNodeGetOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeGetOptions object itself. + */ + public ComputeNodeGetOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeGetOptions object itself. + */ + public ComputeNodeGetOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeGetOptions object itself. + */ + public ComputeNodeGetOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeGetOptions object itself. + */ + public ComputeNodeGetOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteDesktopHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteDesktopHeaders.java new file mode 100644 index 000000000000..98eb55c7be3a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteDesktopHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetRemoteDesktop operation. + */ +public class ComputeNodeGetRemoteDesktopHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeGetRemoteDesktopHeaders object itself. + */ + public ComputeNodeGetRemoteDesktopHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeGetRemoteDesktopHeaders object itself. + */ + public ComputeNodeGetRemoteDesktopHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ComputeNodeGetRemoteDesktopHeaders object itself. + */ + public ComputeNodeGetRemoteDesktopHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ComputeNodeGetRemoteDesktopHeaders object itself. + */ + public ComputeNodeGetRemoteDesktopHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteDesktopOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteDesktopOptions.java new file mode 100644 index 000000000000..412307f6ae1f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteDesktopOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for getRemoteDesktop operation. + */ +public class ComputeNodeGetRemoteDesktopOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeGetRemoteDesktopOptions object itself. + */ + public ComputeNodeGetRemoteDesktopOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeGetRemoteDesktopOptions object itself. + */ + public ComputeNodeGetRemoteDesktopOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeGetRemoteDesktopOptions object itself. + */ + public ComputeNodeGetRemoteDesktopOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeGetRemoteDesktopOptions object itself. + */ + public ComputeNodeGetRemoteDesktopOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteLoginSettingsHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteLoginSettingsHeaders.java new file mode 100644 index 000000000000..9c65c8040451 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteLoginSettingsHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetRemoteLoginSettings operation. + */ +public class ComputeNodeGetRemoteLoginSettingsHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeGetRemoteLoginSettingsHeaders object itself. + */ + public ComputeNodeGetRemoteLoginSettingsHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeGetRemoteLoginSettingsHeaders object itself. + */ + public ComputeNodeGetRemoteLoginSettingsHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ComputeNodeGetRemoteLoginSettingsHeaders object itself. + */ + public ComputeNodeGetRemoteLoginSettingsHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ComputeNodeGetRemoteLoginSettingsHeaders object itself. + */ + public ComputeNodeGetRemoteLoginSettingsHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteLoginSettingsOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteLoginSettingsOptions.java new file mode 100644 index 000000000000..a4945f8141b9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteLoginSettingsOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for getRemoteLoginSettings operation. + */ +public class ComputeNodeGetRemoteLoginSettingsOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeGetRemoteLoginSettingsOptions object itself. + */ + public ComputeNodeGetRemoteLoginSettingsOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeGetRemoteLoginSettingsOptions object itself. + */ + public ComputeNodeGetRemoteLoginSettingsOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeGetRemoteLoginSettingsOptions object itself. + */ + public ComputeNodeGetRemoteLoginSettingsOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeGetRemoteLoginSettingsOptions object itself. + */ + public ComputeNodeGetRemoteLoginSettingsOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteLoginSettingsResult.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteLoginSettingsResult.java new file mode 100644 index 000000000000..40b1c8502a36 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeGetRemoteLoginSettingsResult.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The remote login settings for a compute node. + */ +public class ComputeNodeGetRemoteLoginSettingsResult { + /** + * The IP address used for remote login to the compute node. + */ + @JsonProperty(value = "remoteLoginIPAddress", required = true) + private String remoteLoginIPAddress; + + /** + * The port used for remote login to the compute node. + */ + @JsonProperty(value = "remoteLoginPort", required = true) + private int remoteLoginPort; + + /** + * Get the remoteLoginIPAddress value. + * + * @return the remoteLoginIPAddress value + */ + public String remoteLoginIPAddress() { + return this.remoteLoginIPAddress; + } + + /** + * Set the remoteLoginIPAddress value. + * + * @param remoteLoginIPAddress the remoteLoginIPAddress value to set + * @return the ComputeNodeGetRemoteLoginSettingsResult object itself. + */ + public ComputeNodeGetRemoteLoginSettingsResult withRemoteLoginIPAddress(String remoteLoginIPAddress) { + this.remoteLoginIPAddress = remoteLoginIPAddress; + return this; + } + + /** + * Get the remoteLoginPort value. + * + * @return the remoteLoginPort value + */ + public int remoteLoginPort() { + return this.remoteLoginPort; + } + + /** + * Set the remoteLoginPort value. + * + * @param remoteLoginPort the remoteLoginPort value to set + * @return the ComputeNodeGetRemoteLoginSettingsResult object itself. + */ + public ComputeNodeGetRemoteLoginSettingsResult withRemoteLoginPort(int remoteLoginPort) { + this.remoteLoginPort = remoteLoginPort; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeInformation.java new file mode 100644 index 000000000000..975272cf12ac --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeInformation.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about the compute node on which a task ran. + */ +public class ComputeNodeInformation { + /** + * An identifier for the compute node on which the task ran, which can be + * passed when adding a task to request that the task be scheduled on this + * compute node. + */ + @JsonProperty(value = "affinityId") + private String affinityId; + + /** + * The URL of the node on which the task ran. + */ + @JsonProperty(value = "nodeUrl") + private String nodeUrl; + + /** + * The ID of the pool on which the task ran. + */ + @JsonProperty(value = "poolId") + private String poolId; + + /** + * The ID of the node on which the task ran. + */ + @JsonProperty(value = "nodeId") + private String nodeId; + + /** + * The root directory of the task on the compute node. + */ + @JsonProperty(value = "taskRootDirectory") + private String taskRootDirectory; + + /** + * The URL to the root directory of the task on the compute node. + */ + @JsonProperty(value = "taskRootDirectoryUrl") + private String taskRootDirectoryUrl; + + /** + * Get the affinityId value. + * + * @return the affinityId value + */ + public String affinityId() { + return this.affinityId; + } + + /** + * Set the affinityId value. + * + * @param affinityId the affinityId value to set + * @return the ComputeNodeInformation object itself. + */ + public ComputeNodeInformation withAffinityId(String affinityId) { + this.affinityId = affinityId; + return this; + } + + /** + * Get the nodeUrl value. + * + * @return the nodeUrl value + */ + public String nodeUrl() { + return this.nodeUrl; + } + + /** + * Set the nodeUrl value. + * + * @param nodeUrl the nodeUrl value to set + * @return the ComputeNodeInformation object itself. + */ + public ComputeNodeInformation withNodeUrl(String nodeUrl) { + this.nodeUrl = nodeUrl; + return this; + } + + /** + * Get the poolId value. + * + * @return the poolId value + */ + public String poolId() { + return this.poolId; + } + + /** + * Set the poolId value. + * + * @param poolId the poolId value to set + * @return the ComputeNodeInformation object itself. + */ + public ComputeNodeInformation withPoolId(String poolId) { + this.poolId = poolId; + return this; + } + + /** + * Get the nodeId value. + * + * @return the nodeId value + */ + public String nodeId() { + return this.nodeId; + } + + /** + * Set the nodeId value. + * + * @param nodeId the nodeId value to set + * @return the ComputeNodeInformation object itself. + */ + public ComputeNodeInformation withNodeId(String nodeId) { + this.nodeId = nodeId; + return this; + } + + /** + * Get the taskRootDirectory value. + * + * @return the taskRootDirectory value + */ + public String taskRootDirectory() { + return this.taskRootDirectory; + } + + /** + * Set the taskRootDirectory value. + * + * @param taskRootDirectory the taskRootDirectory value to set + * @return the ComputeNodeInformation object itself. + */ + public ComputeNodeInformation withTaskRootDirectory(String taskRootDirectory) { + this.taskRootDirectory = taskRootDirectory; + return this; + } + + /** + * Get the taskRootDirectoryUrl value. + * + * @return the taskRootDirectoryUrl value + */ + public String taskRootDirectoryUrl() { + return this.taskRootDirectoryUrl; + } + + /** + * Set the taskRootDirectoryUrl value. + * + * @param taskRootDirectoryUrl the taskRootDirectoryUrl value to set + * @return the ComputeNodeInformation object itself. + */ + public ComputeNodeInformation withTaskRootDirectoryUrl(String taskRootDirectoryUrl) { + this.taskRootDirectoryUrl = taskRootDirectoryUrl; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeListHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeListHeaders.java new file mode 100644 index 000000000000..408c99275a66 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeListHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for List operation. + */ +public class ComputeNodeListHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeListHeaders object itself. + */ + public ComputeNodeListHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeListHeaders object itself. + */ + public ComputeNodeListHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ComputeNodeListHeaders object itself. + */ + public ComputeNodeListHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ComputeNodeListHeaders object itself. + */ + public ComputeNodeListHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeListNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeListNextOptions.java new file mode 100644 index 000000000000..e8bcb681e6f3 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeListNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listNext operation. + */ +public class ComputeNodeListNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeListNextOptions object itself. + */ + public ComputeNodeListNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeListNextOptions object itself. + */ + public ComputeNodeListNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeListNextOptions object itself. + */ + public ComputeNodeListNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeListOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeListOptions.java new file mode 100644 index 000000000000..1416a9e8b828 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeListOptions.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for list operation. + */ +public class ComputeNodeListOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-nodes-in-a-pool. + */ + @JsonProperty(value = "") + private String filter; + + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * nodes can be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-nodes-in-a-pool. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-nodes-in-a-pool. + * + * @param filter the filter value to set + * @return the ComputeNodeListOptions object itself. + */ + public ComputeNodeListOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the ComputeNodeListOptions object itself. + */ + public ComputeNodeListOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 nodes can be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 nodes can be returned. + * + * @param maxResults the maxResults value to set + * @return the ComputeNodeListOptions object itself. + */ + public ComputeNodeListOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeListOptions object itself. + */ + public ComputeNodeListOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeListOptions object itself. + */ + public ComputeNodeListOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeListOptions object itself. + */ + public ComputeNodeListOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeListOptions object itself. + */ + public ComputeNodeListOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeRebootHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeRebootHeaders.java new file mode 100644 index 000000000000..62c7a64dbc88 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeRebootHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Reboot operation. + */ +public class ComputeNodeRebootHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeRebootHeaders object itself. + */ + public ComputeNodeRebootHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeRebootHeaders object itself. + */ + public ComputeNodeRebootHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ComputeNodeRebootHeaders object itself. + */ + public ComputeNodeRebootHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ComputeNodeRebootHeaders object itself. + */ + public ComputeNodeRebootHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the ComputeNodeRebootHeaders object itself. + */ + public ComputeNodeRebootHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeRebootOption.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeRebootOption.java new file mode 100644 index 000000000000..1bfa3ce38e85 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeRebootOption.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ComputeNodeRebootOption. + */ +public enum ComputeNodeRebootOption { + /** Terminate running task processes and requeue the tasks. The tasks will run again when a node is available. Restart the node as soon as tasks have been terminated. */ + REQUEUE("requeue"), + + /** Terminate running tasks. The tasks will be completed with failureInfo indicating that they were terminated, and will not run again. Restart the node as soon as tasks have been terminated. */ + TERMINATE("terminate"), + + /** Allow currently running tasks to complete. Schedule no new tasks while waiting. Restart the node when all tasks have completed. */ + TASK_COMPLETION("taskcompletion"), + + /** Allow currently running tasks to complete, then wait for all task data retention periods to expire. Schedule no new tasks while waiting. Restart the node when all task retention periods have expired. */ + RETAINED_DATA("retaineddata"); + + /** The actual serialized value for a ComputeNodeRebootOption instance. */ + private String value; + + ComputeNodeRebootOption(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ComputeNodeRebootOption instance. + * + * @param value the serialized value to parse. + * @return the parsed ComputeNodeRebootOption object, or null if unable to parse. + */ + @JsonCreator + public static ComputeNodeRebootOption fromString(String value) { + ComputeNodeRebootOption[] items = ComputeNodeRebootOption.values(); + for (ComputeNodeRebootOption item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeRebootOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeRebootOptions.java new file mode 100644 index 000000000000..fb58ae568d4c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeRebootOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for reboot operation. + */ +public class ComputeNodeRebootOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeRebootOptions object itself. + */ + public ComputeNodeRebootOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeRebootOptions object itself. + */ + public ComputeNodeRebootOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeRebootOptions object itself. + */ + public ComputeNodeRebootOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeRebootOptions object itself. + */ + public ComputeNodeRebootOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeReimageHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeReimageHeaders.java new file mode 100644 index 000000000000..63ba6e2eb112 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeReimageHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Reimage operation. + */ +public class ComputeNodeReimageHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeReimageHeaders object itself. + */ + public ComputeNodeReimageHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeReimageHeaders object itself. + */ + public ComputeNodeReimageHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ComputeNodeReimageHeaders object itself. + */ + public ComputeNodeReimageHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ComputeNodeReimageHeaders object itself. + */ + public ComputeNodeReimageHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the ComputeNodeReimageHeaders object itself. + */ + public ComputeNodeReimageHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeReimageOption.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeReimageOption.java new file mode 100644 index 000000000000..1651d84ad64b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeReimageOption.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ComputeNodeReimageOption. + */ +public enum ComputeNodeReimageOption { + /** Terminate running task processes and requeue the tasks. The tasks will run again when a node is available. Reimage the node as soon as tasks have been terminated. */ + REQUEUE("requeue"), + + /** Terminate running tasks. The tasks will be completed with failureInfo indicating that they were terminated, and will not run again. Reimage the node as soon as tasks have been terminated. */ + TERMINATE("terminate"), + + /** Allow currently running tasks to complete. Schedule no new tasks while waiting. Reimage the node when all tasks have completed. */ + TASK_COMPLETION("taskcompletion"), + + /** Allow currently running tasks to complete, then wait for all task data retention periods to expire. Schedule no new tasks while waiting. Reimage the node when all task retention periods have expired. */ + RETAINED_DATA("retaineddata"); + + /** The actual serialized value for a ComputeNodeReimageOption instance. */ + private String value; + + ComputeNodeReimageOption(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ComputeNodeReimageOption instance. + * + * @param value the serialized value to parse. + * @return the parsed ComputeNodeReimageOption object, or null if unable to parse. + */ + @JsonCreator + public static ComputeNodeReimageOption fromString(String value) { + ComputeNodeReimageOption[] items = ComputeNodeReimageOption.values(); + for (ComputeNodeReimageOption item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeReimageOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeReimageOptions.java new file mode 100644 index 000000000000..2c346a5ef0ff --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeReimageOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for reimage operation. + */ +public class ComputeNodeReimageOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeReimageOptions object itself. + */ + public ComputeNodeReimageOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeReimageOptions object itself. + */ + public ComputeNodeReimageOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeReimageOptions object itself. + */ + public ComputeNodeReimageOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeReimageOptions object itself. + */ + public ComputeNodeReimageOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeState.java new file mode 100644 index 000000000000..3713cda59366 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeState.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ComputeNodeState. + */ +public enum ComputeNodeState { + /** The node is not currently running a task. */ + IDLE("idle"), + + /** The node is rebooting. */ + REBOOTING("rebooting"), + + /** The node is reimaging. */ + REIMAGING("reimaging"), + + /** The node is running one or more tasks (other than a start task). */ + RUNNING("running"), + + /** The node cannot be used for task execution due to errors. */ + UNUSABLE("unusable"), + + /** The Batch service has obtained the underlying virtual machine from Azure Compute, but it has not yet started to join the pool. */ + CREATING("creating"), + + /** The Batch service is starting on the underlying virtual machine. */ + STARTING("starting"), + + /** The start task has started running on the compute node, but waitForSuccess is set and the start task has not yet completed. */ + WAITING_FOR_START_TASK("waitingforstarttask"), + + /** The start task has failed on the compute node (and exhausted all retries), and waitForSuccess is set. The node is not usable for running tasks. */ + START_TASK_FAILED("starttaskfailed"), + + /** The Batch service has lost contact with the node, and does not know its true state. */ + UNKNOWN("unknown"), + + /** The node is leaving the pool, either because the user explicitly removed it or because the pool is resizing or autoscaling down. */ + LEAVING_POOL("leavingpool"), + + /** The node is not currently running a task, and scheduling of new tasks to the node is disabled. */ + OFFLINE("offline"), + + /** The low-priority node has been preempted. Tasks which were running on the node when it was pre-empted will be rescheduled when another node becomes available. */ + PREEMPTED("preempted"); + + /** The actual serialized value for a ComputeNodeState instance. */ + private String value; + + ComputeNodeState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ComputeNodeState instance. + * + * @param value the serialized value to parse. + * @return the parsed ComputeNodeState object, or null if unable to parse. + */ + @JsonCreator + public static ComputeNodeState fromString(String value) { + ComputeNodeState[] items = ComputeNodeState.values(); + for (ComputeNodeState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUpdateUserHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUpdateUserHeaders.java new file mode 100644 index 000000000000..d74c601a010a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUpdateUserHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for UpdateUser operation. + */ +public class ComputeNodeUpdateUserHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeUpdateUserHeaders object itself. + */ + public ComputeNodeUpdateUserHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeUpdateUserHeaders object itself. + */ + public ComputeNodeUpdateUserHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the ComputeNodeUpdateUserHeaders object itself. + */ + public ComputeNodeUpdateUserHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the ComputeNodeUpdateUserHeaders object itself. + */ + public ComputeNodeUpdateUserHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the ComputeNodeUpdateUserHeaders object itself. + */ + public ComputeNodeUpdateUserHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUpdateUserOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUpdateUserOptions.java new file mode 100644 index 000000000000..975ad97e285b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUpdateUserOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for updateUser operation. + */ +public class ComputeNodeUpdateUserOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeUpdateUserOptions object itself. + */ + public ComputeNodeUpdateUserOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeUpdateUserOptions object itself. + */ + public ComputeNodeUpdateUserOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeUpdateUserOptions object itself. + */ + public ComputeNodeUpdateUserOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeUpdateUserOptions object itself. + */ + public ComputeNodeUpdateUserOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUploadBatchServiceLogsHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUploadBatchServiceLogsHeaders.java new file mode 100644 index 000000000000..e96425d3b598 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUploadBatchServiceLogsHeaders.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for UploadBatchServiceLogs operation. + */ +public class ComputeNodeUploadBatchServiceLogsHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeUploadBatchServiceLogsHeaders object itself. + */ + public ComputeNodeUploadBatchServiceLogsHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the ComputeNodeUploadBatchServiceLogsHeaders object itself. + */ + public ComputeNodeUploadBatchServiceLogsHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUploadBatchServiceLogsOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUploadBatchServiceLogsOptions.java new file mode 100644 index 000000000000..bb688eba9ddf --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUploadBatchServiceLogsOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for uploadBatchServiceLogs operation. + */ +public class ComputeNodeUploadBatchServiceLogsOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the ComputeNodeUploadBatchServiceLogsOptions object itself. + */ + public ComputeNodeUploadBatchServiceLogsOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the ComputeNodeUploadBatchServiceLogsOptions object itself. + */ + public ComputeNodeUploadBatchServiceLogsOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the ComputeNodeUploadBatchServiceLogsOptions object itself. + */ + public ComputeNodeUploadBatchServiceLogsOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the ComputeNodeUploadBatchServiceLogsOptions object itself. + */ + public ComputeNodeUploadBatchServiceLogsOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUser.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUser.java new file mode 100644 index 000000000000..fbc82155aee8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ComputeNodeUser.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A user account for RDP or SSH access on a compute node. + */ +public class ComputeNodeUser { + /** + * The user name of the account. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Whether the account should be an administrator on the compute node. + * The default value is false. + */ + @JsonProperty(value = "isAdmin") + private Boolean isAdmin; + + /** + * The time at which the account should expire. + * If omitted, the default is 1 day from the current time. For Linux + * compute nodes, the expiryTime has a precision up to a day. + */ + @JsonProperty(value = "expiryTime") + private DateTime expiryTime; + + /** + * The password of the account. + * The password is required for Windows nodes (those created with + * 'cloudServiceConfiguration', or created with + * 'virtualMachineConfiguration' using a Windows image reference). For + * Linux compute nodes, the password can optionally be specified along with + * the sshPublicKey property. + */ + @JsonProperty(value = "password") + private String password; + + /** + * The SSH public key that can be used for remote login to the compute + * node. + * The public key should be compatible with OpenSSH encoding and should be + * base 64 encoded. This property can be specified only for Linux nodes. If + * this is specified for a Windows node, then the Batch service rejects the + * request; if you are calling the REST API directly, the HTTP status code + * is 400 (Bad Request). + */ + @JsonProperty(value = "sshPublicKey") + private String sshPublicKey; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the ComputeNodeUser object itself. + */ + public ComputeNodeUser withName(String name) { + this.name = name; + return this; + } + + /** + * Get the default value is false. + * + * @return the isAdmin value + */ + public Boolean isAdmin() { + return this.isAdmin; + } + + /** + * Set the default value is false. + * + * @param isAdmin the isAdmin value to set + * @return the ComputeNodeUser object itself. + */ + public ComputeNodeUser withIsAdmin(Boolean isAdmin) { + this.isAdmin = isAdmin; + return this; + } + + /** + * Get if omitted, the default is 1 day from the current time. For Linux compute nodes, the expiryTime has a precision up to a day. + * + * @return the expiryTime value + */ + public DateTime expiryTime() { + return this.expiryTime; + } + + /** + * Set if omitted, the default is 1 day from the current time. For Linux compute nodes, the expiryTime has a precision up to a day. + * + * @param expiryTime the expiryTime value to set + * @return the ComputeNodeUser object itself. + */ + public ComputeNodeUser withExpiryTime(DateTime expiryTime) { + this.expiryTime = expiryTime; + return this; + } + + /** + * Get the password is required for Windows nodes (those created with 'cloudServiceConfiguration', or created with 'virtualMachineConfiguration' using a Windows image reference). For Linux compute nodes, the password can optionally be specified along with the sshPublicKey property. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set the password is required for Windows nodes (those created with 'cloudServiceConfiguration', or created with 'virtualMachineConfiguration' using a Windows image reference). For Linux compute nodes, the password can optionally be specified along with the sshPublicKey property. + * + * @param password the password value to set + * @return the ComputeNodeUser object itself. + */ + public ComputeNodeUser withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the public key should be compatible with OpenSSH encoding and should be base 64 encoded. This property can be specified only for Linux nodes. If this is specified for a Windows node, then the Batch service rejects the request; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @return the sshPublicKey value + */ + public String sshPublicKey() { + return this.sshPublicKey; + } + + /** + * Set the public key should be compatible with OpenSSH encoding and should be base 64 encoded. This property can be specified only for Linux nodes. If this is specified for a Windows node, then the Batch service rejects the request; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @param sshPublicKey the sshPublicKey value to set + * @return the ComputeNodeUser object itself. + */ + public ComputeNodeUser withSshPublicKey(String sshPublicKey) { + this.sshPublicKey = sshPublicKey; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ContainerConfiguration.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ContainerConfiguration.java new file mode 100644 index 000000000000..f6b1adec3561 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ContainerConfiguration.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The configuration for container-enabled pools. + */ +public class ContainerConfiguration { + /** + * The container technology to be used. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * The collection of container image names. + * This is the full image reference, as would be specified to "docker + * pull". An image will be sourced from the default Docker registry unless + * the image is fully qualified with an alternative registry. + */ + @JsonProperty(value = "containerImageNames") + private List containerImageNames; + + /** + * Additional private registries from which containers can be pulled. + * If any images must be downloaded from a private registry which requires + * credentials, then those credentials must be provided here. + */ + @JsonProperty(value = "containerRegistries") + private List containerRegistries; + + /** + * Creates an instance of ContainerConfiguration class. + */ + public ContainerConfiguration() { + type = "dockerCompatible"; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the ContainerConfiguration object itself. + */ + public ContainerConfiguration withType(String type) { + this.type = type; + return this; + } + + /** + * Get this is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry. + * + * @return the containerImageNames value + */ + public List containerImageNames() { + return this.containerImageNames; + } + + /** + * Set this is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry. + * + * @param containerImageNames the containerImageNames value to set + * @return the ContainerConfiguration object itself. + */ + public ContainerConfiguration withContainerImageNames(List containerImageNames) { + this.containerImageNames = containerImageNames; + return this; + } + + /** + * Get if any images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. + * + * @return the containerRegistries value + */ + public List containerRegistries() { + return this.containerRegistries; + } + + /** + * Set if any images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. + * + * @param containerRegistries the containerRegistries value to set + * @return the ContainerConfiguration object itself. + */ + public ContainerConfiguration withContainerRegistries(List containerRegistries) { + this.containerRegistries = containerRegistries; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ContainerRegistry.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ContainerRegistry.java new file mode 100644 index 000000000000..c29deb622d1a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ContainerRegistry.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A private container registry. + */ +public class ContainerRegistry { + /** + * The registry URL. + * If omitted, the default is "docker.io". + */ + @JsonProperty(value = "registryServer") + private String registryServer; + + /** + * The user name to log into the registry server. + */ + @JsonProperty(value = "username", required = true) + private String userName; + + /** + * The password to log into the registry server. + */ + @JsonProperty(value = "password", required = true) + private String password; + + /** + * Get if omitted, the default is "docker.io". + * + * @return the registryServer value + */ + public String registryServer() { + return this.registryServer; + } + + /** + * Set if omitted, the default is "docker.io". + * + * @param registryServer the registryServer value to set + * @return the ContainerRegistry object itself. + */ + public ContainerRegistry withRegistryServer(String registryServer) { + this.registryServer = registryServer; + return this; + } + + /** + * Get the userName value. + * + * @return the userName value + */ + public String userName() { + return this.userName; + } + + /** + * Set the userName value. + * + * @param userName the userName value to set + * @return the ContainerRegistry object itself. + */ + public ContainerRegistry withUserName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get the password value. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set the password value. + * + * @param password the password value to set + * @return the ContainerRegistry object itself. + */ + public ContainerRegistry withPassword(String password) { + this.password = password; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DataDisk.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DataDisk.java new file mode 100644 index 000000000000..57c48e955f86 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DataDisk.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Settings which will be used by the data disks associated to compute nodes in + * the pool. + */ +public class DataDisk { + /** + * The logical unit number. + * The lun is used to uniquely identify each data disk. If attaching + * multiple disks, each should have a distinct lun. + */ + @JsonProperty(value = "lun", required = true) + private int lun; + + /** + * The type of caching to be enabled for the data disks. + * The default value for caching is readwrite. For information about the + * caching options see: + * https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. + * Possible values include: 'none', 'readOnly', 'readWrite'. + */ + @JsonProperty(value = "caching") + private CachingType caching; + + /** + * The initial disk size in gigabytes. + */ + @JsonProperty(value = "diskSizeGB", required = true) + private int diskSizeGB; + + /** + * The storage account type to be used for the data disk. + * If omitted, the default is "standard_lrs". Possible values include: + * 'StandardLRS', 'PremiumLRS'. + */ + @JsonProperty(value = "storageAccountType") + private StorageAccountType storageAccountType; + + /** + * Get the lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. + * + * @return the lun value + */ + public int lun() { + return this.lun; + } + + /** + * Set the lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. + * + * @param lun the lun value to set + * @return the DataDisk object itself. + */ + public DataDisk withLun(int lun) { + this.lun = lun; + return this; + } + + /** + * Get the default value for caching is readwrite. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Possible values include: 'none', 'readOnly', 'readWrite'. + * + * @return the caching value + */ + public CachingType caching() { + return this.caching; + } + + /** + * Set the default value for caching is readwrite. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Possible values include: 'none', 'readOnly', 'readWrite'. + * + * @param caching the caching value to set + * @return the DataDisk object itself. + */ + public DataDisk withCaching(CachingType caching) { + this.caching = caching; + return this; + } + + /** + * Get the diskSizeGB value. + * + * @return the diskSizeGB value + */ + public int diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB value. + * + * @param diskSizeGB the diskSizeGB value to set + * @return the DataDisk object itself. + */ + public DataDisk withDiskSizeGB(int diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get if omitted, the default is "standard_lrs". Possible values include: 'StandardLRS', 'PremiumLRS'. + * + * @return the storageAccountType value + */ + public StorageAccountType storageAccountType() { + return this.storageAccountType; + } + + /** + * Set if omitted, the default is "standard_lrs". Possible values include: 'StandardLRS', 'PremiumLRS'. + * + * @param storageAccountType the storageAccountType value to set + * @return the DataDisk object itself. + */ + public DataDisk withStorageAccountType(StorageAccountType storageAccountType) { + this.storageAccountType = storageAccountType; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DeleteCertificateError.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DeleteCertificateError.java new file mode 100644 index 000000000000..01e629c8154c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DeleteCertificateError.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error encountered by the Batch service when deleting a certificate. + */ +public class DeleteCertificateError { + /** + * An identifier for the certificate deletion error. Codes are invariant + * and are intended to be consumed programmatically. + */ + @JsonProperty(value = "code") + private String code; + + /** + * A message describing the certificate deletion error, intended to be + * suitable for display in a user interface. + */ + @JsonProperty(value = "message") + private String message; + + /** + * A list of additional error details related to the certificate deletion + * error. + * This list includes details such as the active pools and nodes + * referencing this certificate. However, if a large number of resources + * reference the certificate, the list contains only about the first + * hundred. + */ + @JsonProperty(value = "values") + private List values; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the DeleteCertificateError object itself. + */ + public DeleteCertificateError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the DeleteCertificateError object itself. + */ + public DeleteCertificateError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get this list includes details such as the active pools and nodes referencing this certificate. However, if a large number of resources reference the certificate, the list contains only about the first hundred. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set this list includes details such as the active pools and nodes referencing this certificate. However, if a large number of resources reference the certificate, the list contains only about the first hundred. + * + * @param values the values value to set + * @return the DeleteCertificateError object itself. + */ + public DeleteCertificateError withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DependencyAction.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DependencyAction.java new file mode 100644 index 000000000000..e37979bee941 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DependencyAction.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DependencyAction. + */ +public enum DependencyAction { + /** Satisfy the task's dependencies. */ + SATISFY("satisfy"), + + /** Block the task's dependencies. */ + BLOCK("block"); + + /** The actual serialized value for a DependencyAction instance. */ + private String value; + + DependencyAction(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DependencyAction instance. + * + * @param value the serialized value to parse. + * @return the parsed DependencyAction object, or null if unable to parse. + */ + @JsonCreator + public static DependencyAction fromString(String value) { + DependencyAction[] items = DependencyAction.values(); + for (DependencyAction item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DisableComputeNodeSchedulingOption.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DisableComputeNodeSchedulingOption.java new file mode 100644 index 000000000000..cf35134710bd --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DisableComputeNodeSchedulingOption.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DisableComputeNodeSchedulingOption. + */ +public enum DisableComputeNodeSchedulingOption { + /** Terminate running task processes and requeue the tasks. The tasks may run again on other compute nodes, or when task scheduling is re-enabled on this node. Enter offline state as soon as tasks have been terminated. */ + REQUEUE("requeue"), + + /** Terminate running tasks. The tasks will be completed with failureInfo indicating that they were terminated, and will not run again. Enter offline state as soon as tasks have been terminated. */ + TERMINATE("terminate"), + + /** Allow currently running tasks to complete. Schedule no new tasks while waiting. Enter offline state when all tasks have completed. */ + TASK_COMPLETION("taskcompletion"); + + /** The actual serialized value for a DisableComputeNodeSchedulingOption instance. */ + private String value; + + DisableComputeNodeSchedulingOption(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DisableComputeNodeSchedulingOption instance. + * + * @param value the serialized value to parse. + * @return the parsed DisableComputeNodeSchedulingOption object, or null if unable to parse. + */ + @JsonCreator + public static DisableComputeNodeSchedulingOption fromString(String value) { + DisableComputeNodeSchedulingOption[] items = DisableComputeNodeSchedulingOption.values(); + for (DisableComputeNodeSchedulingOption item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DisableJobOption.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DisableJobOption.java new file mode 100644 index 000000000000..20b8ce4d4c9b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DisableJobOption.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DisableJobOption. + */ +public enum DisableJobOption { + /** Terminate running tasks and requeue them. The tasks will run again when the job is enabled. */ + REQUEUE("requeue"), + + /** Terminate running tasks. The tasks will be completed with failureInfo indicating that they were terminated, and will not run again. */ + TERMINATE("terminate"), + + /** Allow currently running tasks to complete. */ + WAIT("wait"); + + /** The actual serialized value for a DisableJobOption instance. */ + private String value; + + DisableJobOption(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DisableJobOption instance. + * + * @param value the serialized value to parse. + * @return the parsed DisableJobOption object, or null if unable to parse. + */ + @JsonCreator + public static DisableJobOption fromString(String value) { + DisableJobOption[] items = DisableJobOption.values(); + for (DisableJobOption item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DynamicVNetAssignmentScope.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DynamicVNetAssignmentScope.java new file mode 100644 index 000000000000..4e3388fb1ba1 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/DynamicVNetAssignmentScope.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DynamicVNetAssignmentScope. + */ +public enum DynamicVNetAssignmentScope { + /** No dynamic VNet assignment is enabled. */ + NONE("none"), + + /** Dynamic VNet assignment is done per-job. */ + JOB("job"); + + /** The actual serialized value for a DynamicVNetAssignmentScope instance. */ + private String value; + + DynamicVNetAssignmentScope(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DynamicVNetAssignmentScope instance. + * + * @param value the serialized value to parse. + * @return the parsed DynamicVNetAssignmentScope object, or null if unable to parse. + */ + @JsonCreator + public static DynamicVNetAssignmentScope fromString(String value) { + DynamicVNetAssignmentScope[] items = DynamicVNetAssignmentScope.values(); + for (DynamicVNetAssignmentScope item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ElevationLevel.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ElevationLevel.java new file mode 100644 index 000000000000..c0139a5dfe3b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ElevationLevel.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ElevationLevel. + */ +public enum ElevationLevel { + /** The user is a standard user without elevated access. */ + NON_ADMIN("nonadmin"), + + /** The user is a user with elevated access and operates with full Administrator permissions. */ + ADMIN("admin"); + + /** The actual serialized value for a ElevationLevel instance. */ + private String value; + + ElevationLevel(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ElevationLevel instance. + * + * @param value the serialized value to parse. + * @return the parsed ElevationLevel object, or null if unable to parse. + */ + @JsonCreator + public static ElevationLevel fromString(String value) { + ElevationLevel[] items = ElevationLevel.values(); + for (ElevationLevel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/EnvironmentSetting.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/EnvironmentSetting.java new file mode 100644 index 000000000000..a69673c5afc9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/EnvironmentSetting.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An environment variable to be set on a task process. + */ +public class EnvironmentSetting { + /** + * The name of the environment variable. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The value of the environment variable. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the EnvironmentSetting object itself. + */ + public EnvironmentSetting withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the EnvironmentSetting object itself. + */ + public EnvironmentSetting withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ErrorCategory.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ErrorCategory.java new file mode 100644 index 000000000000..d0deda98a123 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ErrorCategory.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ErrorCategory. + */ +public enum ErrorCategory { + /** The error is due to a user issue, such as misconfiguration. */ + USER_ERROR("usererror"), + + /** The error is due to an internal server issue. */ + SERVER_ERROR("servererror"); + + /** The actual serialized value for a ErrorCategory instance. */ + private String value; + + ErrorCategory(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ErrorCategory instance. + * + * @param value the serialized value to parse. + * @return the parsed ErrorCategory object, or null if unable to parse. + */ + @JsonCreator + public static ErrorCategory fromString(String value) { + ErrorCategory[] items = ErrorCategory.values(); + for (ErrorCategory item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ErrorMessage.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ErrorMessage.java new file mode 100644 index 000000000000..017af8ca9c12 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ErrorMessage.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error message received in an Azure Batch error response. + */ +public class ErrorMessage { + /** + * The language code of the error message. + */ + @JsonProperty(value = "lang") + private String lang; + + /** + * The text of the message. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the lang value. + * + * @return the lang value + */ + public String lang() { + return this.lang; + } + + /** + * Set the lang value. + * + * @param lang the lang value to set + * @return the ErrorMessage object itself. + */ + public ErrorMessage withLang(String lang) { + this.lang = lang; + return this; + } + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the ErrorMessage object itself. + */ + public ErrorMessage withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitCodeMapping.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitCodeMapping.java new file mode 100644 index 000000000000..d102c146e15b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitCodeMapping.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * How the Batch service should respond if a task exits with a particular exit + * code. + */ +public class ExitCodeMapping { + /** + * A process exit code. + */ + @JsonProperty(value = "code", required = true) + private int code; + + /** + * How the Batch service should respond if the task exits with this exit + * code. + */ + @JsonProperty(value = "exitOptions", required = true) + private ExitOptions exitOptions; + + /** + * Get the code value. + * + * @return the code value + */ + public int code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the ExitCodeMapping object itself. + */ + public ExitCodeMapping withCode(int code) { + this.code = code; + return this; + } + + /** + * Get the exitOptions value. + * + * @return the exitOptions value + */ + public ExitOptions exitOptions() { + return this.exitOptions; + } + + /** + * Set the exitOptions value. + * + * @param exitOptions the exitOptions value to set + * @return the ExitCodeMapping object itself. + */ + public ExitCodeMapping withExitOptions(ExitOptions exitOptions) { + this.exitOptions = exitOptions; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitCodeRangeMapping.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitCodeRangeMapping.java new file mode 100644 index 000000000000..54cf43b54dc4 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitCodeRangeMapping.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A range of exit codes and how the Batch service should respond to exit codes + * within that range. + */ +public class ExitCodeRangeMapping { + /** + * The first exit code in the range. + */ + @JsonProperty(value = "start", required = true) + private int start; + + /** + * The last exit code in the range. + */ + @JsonProperty(value = "end", required = true) + private int end; + + /** + * How the Batch service should respond if the task exits with an exit code + * in the range start to end (inclusive). + */ + @JsonProperty(value = "exitOptions", required = true) + private ExitOptions exitOptions; + + /** + * Get the start value. + * + * @return the start value + */ + public int start() { + return this.start; + } + + /** + * Set the start value. + * + * @param start the start value to set + * @return the ExitCodeRangeMapping object itself. + */ + public ExitCodeRangeMapping withStart(int start) { + this.start = start; + return this; + } + + /** + * Get the end value. + * + * @return the end value + */ + public int end() { + return this.end; + } + + /** + * Set the end value. + * + * @param end the end value to set + * @return the ExitCodeRangeMapping object itself. + */ + public ExitCodeRangeMapping withEnd(int end) { + this.end = end; + return this; + } + + /** + * Get the exitOptions value. + * + * @return the exitOptions value + */ + public ExitOptions exitOptions() { + return this.exitOptions; + } + + /** + * Set the exitOptions value. + * + * @param exitOptions the exitOptions value to set + * @return the ExitCodeRangeMapping object itself. + */ + public ExitCodeRangeMapping withExitOptions(ExitOptions exitOptions) { + this.exitOptions = exitOptions; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitConditions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitConditions.java new file mode 100644 index 000000000000..b861f3ed5f5d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitConditions.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies how the Batch service should respond when the task completes. + */ +public class ExitConditions { + /** + * A list of individual task exit codes and how the Batch service should + * respond to them. + */ + @JsonProperty(value = "exitCodes") + private List exitCodes; + + /** + * A list of task exit code ranges and how the Batch service should respond + * to them. + */ + @JsonProperty(value = "exitCodeRanges") + private List exitCodeRanges; + + /** + * How the Batch service should respond if the task fails to start due to + * an error. + */ + @JsonProperty(value = "preProcessingError") + private ExitOptions preProcessingError; + + /** + * How the Batch service should respond if a file upload error occurs. + * If the task exited with an exit code that was specified via exitCodes or + * exitCodeRanges, and then encountered a file upload error, then the + * action specified by the exit code takes precedence. + */ + @JsonProperty(value = "fileUploadError") + private ExitOptions fileUploadError; + + /** + * How the Batch service should respond if the task fails with an exit + * condition not covered by any of the other properties. + * This value is used if the task exits with any nonzero exit code not + * listed in the exitCodes or exitCodeRanges collection, with a + * pre-processing error if the preProcessingError property is not present, + * or with a file upload error if the fileUploadError property is not + * present. If you want non-default behavior on exit code 0, you must list + * it explicitly using the exitCodes or exitCodeRanges collection. + */ + @JsonProperty(value = "default") + private ExitOptions defaultProperty; + + /** + * Get the exitCodes value. + * + * @return the exitCodes value + */ + public List exitCodes() { + return this.exitCodes; + } + + /** + * Set the exitCodes value. + * + * @param exitCodes the exitCodes value to set + * @return the ExitConditions object itself. + */ + public ExitConditions withExitCodes(List exitCodes) { + this.exitCodes = exitCodes; + return this; + } + + /** + * Get the exitCodeRanges value. + * + * @return the exitCodeRanges value + */ + public List exitCodeRanges() { + return this.exitCodeRanges; + } + + /** + * Set the exitCodeRanges value. + * + * @param exitCodeRanges the exitCodeRanges value to set + * @return the ExitConditions object itself. + */ + public ExitConditions withExitCodeRanges(List exitCodeRanges) { + this.exitCodeRanges = exitCodeRanges; + return this; + } + + /** + * Get the preProcessingError value. + * + * @return the preProcessingError value + */ + public ExitOptions preProcessingError() { + return this.preProcessingError; + } + + /** + * Set the preProcessingError value. + * + * @param preProcessingError the preProcessingError value to set + * @return the ExitConditions object itself. + */ + public ExitConditions withPreProcessingError(ExitOptions preProcessingError) { + this.preProcessingError = preProcessingError; + return this; + } + + /** + * Get if the task exited with an exit code that was specified via exitCodes or exitCodeRanges, and then encountered a file upload error, then the action specified by the exit code takes precedence. + * + * @return the fileUploadError value + */ + public ExitOptions fileUploadError() { + return this.fileUploadError; + } + + /** + * Set if the task exited with an exit code that was specified via exitCodes or exitCodeRanges, and then encountered a file upload error, then the action specified by the exit code takes precedence. + * + * @param fileUploadError the fileUploadError value to set + * @return the ExitConditions object itself. + */ + public ExitConditions withFileUploadError(ExitOptions fileUploadError) { + this.fileUploadError = fileUploadError; + return this; + } + + /** + * Get this value is used if the task exits with any nonzero exit code not listed in the exitCodes or exitCodeRanges collection, with a pre-processing error if the preProcessingError property is not present, or with a file upload error if the fileUploadError property is not present. If you want non-default behavior on exit code 0, you must list it explicitly using the exitCodes or exitCodeRanges collection. + * + * @return the defaultProperty value + */ + public ExitOptions defaultProperty() { + return this.defaultProperty; + } + + /** + * Set this value is used if the task exits with any nonzero exit code not listed in the exitCodes or exitCodeRanges collection, with a pre-processing error if the preProcessingError property is not present, or with a file upload error if the fileUploadError property is not present. If you want non-default behavior on exit code 0, you must list it explicitly using the exitCodes or exitCodeRanges collection. + * + * @param defaultProperty the defaultProperty value to set + * @return the ExitConditions object itself. + */ + public ExitConditions withDefaultProperty(ExitOptions defaultProperty) { + this.defaultProperty = defaultProperty; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitOptions.java new file mode 100644 index 000000000000..3aac5aab2ac0 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ExitOptions.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies how the Batch service responds to a particular exit condition. + */ +public class ExitOptions { + /** + * An action to take on the job containing the task, if the task completes + * with the given exit condition and the job's onTaskFailed property is + * 'performExitOptionsJobAction'. + * The default is none for exit code 0 and terminate for all other exit + * conditions. If the job's onTaskFailed property is noaction, then + * specifying this property returns an error and the add task request fails + * with an invalid property value error; if you are calling the REST API + * directly, the HTTP status code is 400 (Bad Request). Possible values + * include: 'none', 'disable', 'terminate'. + */ + @JsonProperty(value = "jobAction") + private JobAction jobAction; + + /** + * An action that the Batch service performs on tasks that depend on this + * task. + * The default is 'satisfy' for exit code 0, and 'block' for all other exit + * conditions. If the job's usesTaskDependencies property is set to false, + * then specifying the dependencyAction property returns an error and the + * add task request fails with an invalid property value error; if you are + * calling the REST API directly, the HTTP status code is 400 (Bad + * Request). Possible values include: 'satisfy', 'block'. + */ + @JsonProperty(value = "dependencyAction") + private DependencyAction dependencyAction; + + /** + * Get the default is none for exit code 0 and terminate for all other exit conditions. If the job's onTaskFailed property is noaction, then specifying this property returns an error and the add task request fails with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). Possible values include: 'none', 'disable', 'terminate'. + * + * @return the jobAction value + */ + public JobAction jobAction() { + return this.jobAction; + } + + /** + * Set the default is none for exit code 0 and terminate for all other exit conditions. If the job's onTaskFailed property is noaction, then specifying this property returns an error and the add task request fails with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). Possible values include: 'none', 'disable', 'terminate'. + * + * @param jobAction the jobAction value to set + * @return the ExitOptions object itself. + */ + public ExitOptions withJobAction(JobAction jobAction) { + this.jobAction = jobAction; + return this; + } + + /** + * Get the default is 'satisfy' for exit code 0, and 'block' for all other exit conditions. If the job's usesTaskDependencies property is set to false, then specifying the dependencyAction property returns an error and the add task request fails with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). Possible values include: 'satisfy', 'block'. + * + * @return the dependencyAction value + */ + public DependencyAction dependencyAction() { + return this.dependencyAction; + } + + /** + * Set the default is 'satisfy' for exit code 0, and 'block' for all other exit conditions. If the job's usesTaskDependencies property is set to false, then specifying the dependencyAction property returns an error and the add task request fails with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). Possible values include: 'satisfy', 'block'. + * + * @param dependencyAction the dependencyAction value to set + * @return the ExitOptions object itself. + */ + public ExitOptions withDependencyAction(DependencyAction dependencyAction) { + this.dependencyAction = dependencyAction; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromComputeNodeHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromComputeNodeHeaders.java new file mode 100644 index 000000000000..e7b0d29181e8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromComputeNodeHeaders.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for DeleteFromComputeNode operation. + */ +public class FileDeleteFromComputeNodeHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private String clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private String requestId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileDeleteFromComputeNodeHeaders object itself. + */ + public FileDeleteFromComputeNodeHeaders withClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the FileDeleteFromComputeNodeHeaders object itself. + */ + public FileDeleteFromComputeNodeHeaders withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromComputeNodeOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromComputeNodeOptions.java new file mode 100644 index 000000000000..587df1d427b6 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromComputeNodeOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for deleteFromComputeNode operation. + */ +public class FileDeleteFromComputeNodeOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the FileDeleteFromComputeNodeOptions object itself. + */ + public FileDeleteFromComputeNodeOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileDeleteFromComputeNodeOptions object itself. + */ + public FileDeleteFromComputeNodeOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the FileDeleteFromComputeNodeOptions object itself. + */ + public FileDeleteFromComputeNodeOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the FileDeleteFromComputeNodeOptions object itself. + */ + public FileDeleteFromComputeNodeOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromTaskHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromTaskHeaders.java new file mode 100644 index 000000000000..d092969cf67f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromTaskHeaders.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for DeleteFromTask operation. + */ +public class FileDeleteFromTaskHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private String clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private String requestId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileDeleteFromTaskHeaders object itself. + */ + public FileDeleteFromTaskHeaders withClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the FileDeleteFromTaskHeaders object itself. + */ + public FileDeleteFromTaskHeaders withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromTaskOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromTaskOptions.java new file mode 100644 index 000000000000..7b3e768ac9f0 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileDeleteFromTaskOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for deleteFromTask operation. + */ +public class FileDeleteFromTaskOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the FileDeleteFromTaskOptions object itself. + */ + public FileDeleteFromTaskOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileDeleteFromTaskOptions object itself. + */ + public FileDeleteFromTaskOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the FileDeleteFromTaskOptions object itself. + */ + public FileDeleteFromTaskOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the FileDeleteFromTaskOptions object itself. + */ + public FileDeleteFromTaskOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromComputeNodeHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromComputeNodeHeaders.java new file mode 100644 index 000000000000..a011829539b7 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromComputeNodeHeaders.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetFromComputeNode operation. + */ +public class FileGetFromComputeNodeHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The file creation time. + */ + @JsonProperty(value = "ocp-creation-time") + private DateTimeRfc1123 ocpCreationTime; + + /** + * Whether the object represents a directory. + */ + @JsonProperty(value = "ocp-batch-file-isdirectory") + private Boolean ocpBatchFileIsdirectory; + + /** + * The URL of the file. + */ + @JsonProperty(value = "ocp-batch-file-url") + private String ocpBatchFileUrl; + + /** + * The file mode attribute in octal format. + */ + @JsonProperty(value = "ocp-batch-file-mode") + private String ocpBatchFileMode; + + /** + * The content type of the file. + */ + @JsonProperty(value = "Content-Type") + private String contentType; + + /** + * The length of the file. + */ + @JsonProperty(value = "Content-Length") + private Long contentLength; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileGetFromComputeNodeHeaders object itself. + */ + public FileGetFromComputeNodeHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the FileGetFromComputeNodeHeaders object itself. + */ + public FileGetFromComputeNodeHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the FileGetFromComputeNodeHeaders object itself. + */ + public FileGetFromComputeNodeHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the FileGetFromComputeNodeHeaders object itself. + */ + public FileGetFromComputeNodeHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the file creation time. + * + * @return the ocpCreationTime value + */ + public DateTime ocpCreationTime() { + if (this.ocpCreationTime == null) { + return null; + } + return this.ocpCreationTime.dateTime(); + } + + /** + * Set the file creation time. + * + * @param ocpCreationTime the ocpCreationTime value to set + * @return the FileGetFromComputeNodeHeaders object itself. + */ + public FileGetFromComputeNodeHeaders withOcpCreationTime(DateTime ocpCreationTime) { + if (ocpCreationTime == null) { + this.ocpCreationTime = null; + } else { + this.ocpCreationTime = new DateTimeRfc1123(ocpCreationTime); + } + return this; + } + + /** + * Get whether the object represents a directory. + * + * @return the ocpBatchFileIsdirectory value + */ + public Boolean ocpBatchFileIsdirectory() { + return this.ocpBatchFileIsdirectory; + } + + /** + * Set whether the object represents a directory. + * + * @param ocpBatchFileIsdirectory the ocpBatchFileIsdirectory value to set + * @return the FileGetFromComputeNodeHeaders object itself. + */ + public FileGetFromComputeNodeHeaders withOcpBatchFileIsdirectory(Boolean ocpBatchFileIsdirectory) { + this.ocpBatchFileIsdirectory = ocpBatchFileIsdirectory; + return this; + } + + /** + * Get the URL of the file. + * + * @return the ocpBatchFileUrl value + */ + public String ocpBatchFileUrl() { + return this.ocpBatchFileUrl; + } + + /** + * Set the URL of the file. + * + * @param ocpBatchFileUrl the ocpBatchFileUrl value to set + * @return the FileGetFromComputeNodeHeaders object itself. + */ + public FileGetFromComputeNodeHeaders withOcpBatchFileUrl(String ocpBatchFileUrl) { + this.ocpBatchFileUrl = ocpBatchFileUrl; + return this; + } + + /** + * Get the file mode attribute in octal format. + * + * @return the ocpBatchFileMode value + */ + public String ocpBatchFileMode() { + return this.ocpBatchFileMode; + } + + /** + * Set the file mode attribute in octal format. + * + * @param ocpBatchFileMode the ocpBatchFileMode value to set + * @return the FileGetFromComputeNodeHeaders object itself. + */ + public FileGetFromComputeNodeHeaders withOcpBatchFileMode(String ocpBatchFileMode) { + this.ocpBatchFileMode = ocpBatchFileMode; + return this; + } + + /** + * Get the content type of the file. + * + * @return the contentType value + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the content type of the file. + * + * @param contentType the contentType value to set + * @return the FileGetFromComputeNodeHeaders object itself. + */ + public FileGetFromComputeNodeHeaders withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the length of the file. + * + * @return the contentLength value + */ + public Long contentLength() { + return this.contentLength; + } + + /** + * Set the length of the file. + * + * @param contentLength the contentLength value to set + * @return the FileGetFromComputeNodeHeaders object itself. + */ + public FileGetFromComputeNodeHeaders withContentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromComputeNodeOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromComputeNodeOptions.java new file mode 100644 index 000000000000..9a568abf395c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromComputeNodeOptions.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for getFromComputeNode operation. + */ +public class FileGetFromComputeNodeOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * The byte range to be retrieved. The default is to retrieve the entire + * file. The format is bytes=startRange-endRange. + */ + @JsonProperty(value = "") + private String ocpRange; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the FileGetFromComputeNodeOptions object itself. + */ + public FileGetFromComputeNodeOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileGetFromComputeNodeOptions object itself. + */ + public FileGetFromComputeNodeOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the FileGetFromComputeNodeOptions object itself. + */ + public FileGetFromComputeNodeOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the FileGetFromComputeNodeOptions object itself. + */ + public FileGetFromComputeNodeOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get the byte range to be retrieved. The default is to retrieve the entire file. The format is bytes=startRange-endRange. + * + * @return the ocpRange value + */ + public String ocpRange() { + return this.ocpRange; + } + + /** + * Set the byte range to be retrieved. The default is to retrieve the entire file. The format is bytes=startRange-endRange. + * + * @param ocpRange the ocpRange value to set + * @return the FileGetFromComputeNodeOptions object itself. + */ + public FileGetFromComputeNodeOptions withOcpRange(String ocpRange) { + this.ocpRange = ocpRange; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the FileGetFromComputeNodeOptions object itself. + */ + public FileGetFromComputeNodeOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the FileGetFromComputeNodeOptions object itself. + */ + public FileGetFromComputeNodeOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromTaskHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromTaskHeaders.java new file mode 100644 index 000000000000..76d414dd5d55 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromTaskHeaders.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetFromTask operation. + */ +public class FileGetFromTaskHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The file creation time. + */ + @JsonProperty(value = "ocp-creation-time") + private DateTimeRfc1123 ocpCreationTime; + + /** + * Whether the object represents a directory. + */ + @JsonProperty(value = "ocp-batch-file-isdirectory") + private Boolean ocpBatchFileIsdirectory; + + /** + * The URL of the file. + */ + @JsonProperty(value = "ocp-batch-file-url") + private String ocpBatchFileUrl; + + /** + * The file mode attribute in octal format. + */ + @JsonProperty(value = "ocp-batch-file-mode") + private String ocpBatchFileMode; + + /** + * The content type of the file. + */ + @JsonProperty(value = "Content-Type") + private String contentType; + + /** + * The length of the file. + */ + @JsonProperty(value = "Content-Length") + private Long contentLength; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileGetFromTaskHeaders object itself. + */ + public FileGetFromTaskHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the FileGetFromTaskHeaders object itself. + */ + public FileGetFromTaskHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the FileGetFromTaskHeaders object itself. + */ + public FileGetFromTaskHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the FileGetFromTaskHeaders object itself. + */ + public FileGetFromTaskHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the file creation time. + * + * @return the ocpCreationTime value + */ + public DateTime ocpCreationTime() { + if (this.ocpCreationTime == null) { + return null; + } + return this.ocpCreationTime.dateTime(); + } + + /** + * Set the file creation time. + * + * @param ocpCreationTime the ocpCreationTime value to set + * @return the FileGetFromTaskHeaders object itself. + */ + public FileGetFromTaskHeaders withOcpCreationTime(DateTime ocpCreationTime) { + if (ocpCreationTime == null) { + this.ocpCreationTime = null; + } else { + this.ocpCreationTime = new DateTimeRfc1123(ocpCreationTime); + } + return this; + } + + /** + * Get whether the object represents a directory. + * + * @return the ocpBatchFileIsdirectory value + */ + public Boolean ocpBatchFileIsdirectory() { + return this.ocpBatchFileIsdirectory; + } + + /** + * Set whether the object represents a directory. + * + * @param ocpBatchFileIsdirectory the ocpBatchFileIsdirectory value to set + * @return the FileGetFromTaskHeaders object itself. + */ + public FileGetFromTaskHeaders withOcpBatchFileIsdirectory(Boolean ocpBatchFileIsdirectory) { + this.ocpBatchFileIsdirectory = ocpBatchFileIsdirectory; + return this; + } + + /** + * Get the URL of the file. + * + * @return the ocpBatchFileUrl value + */ + public String ocpBatchFileUrl() { + return this.ocpBatchFileUrl; + } + + /** + * Set the URL of the file. + * + * @param ocpBatchFileUrl the ocpBatchFileUrl value to set + * @return the FileGetFromTaskHeaders object itself. + */ + public FileGetFromTaskHeaders withOcpBatchFileUrl(String ocpBatchFileUrl) { + this.ocpBatchFileUrl = ocpBatchFileUrl; + return this; + } + + /** + * Get the file mode attribute in octal format. + * + * @return the ocpBatchFileMode value + */ + public String ocpBatchFileMode() { + return this.ocpBatchFileMode; + } + + /** + * Set the file mode attribute in octal format. + * + * @param ocpBatchFileMode the ocpBatchFileMode value to set + * @return the FileGetFromTaskHeaders object itself. + */ + public FileGetFromTaskHeaders withOcpBatchFileMode(String ocpBatchFileMode) { + this.ocpBatchFileMode = ocpBatchFileMode; + return this; + } + + /** + * Get the content type of the file. + * + * @return the contentType value + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the content type of the file. + * + * @param contentType the contentType value to set + * @return the FileGetFromTaskHeaders object itself. + */ + public FileGetFromTaskHeaders withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the length of the file. + * + * @return the contentLength value + */ + public Long contentLength() { + return this.contentLength; + } + + /** + * Set the length of the file. + * + * @param contentLength the contentLength value to set + * @return the FileGetFromTaskHeaders object itself. + */ + public FileGetFromTaskHeaders withContentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromTaskOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromTaskOptions.java new file mode 100644 index 000000000000..11023ec30514 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetFromTaskOptions.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for getFromTask operation. + */ +public class FileGetFromTaskOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * The byte range to be retrieved. The default is to retrieve the entire + * file. The format is bytes=startRange-endRange. + */ + @JsonProperty(value = "") + private String ocpRange; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the FileGetFromTaskOptions object itself. + */ + public FileGetFromTaskOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileGetFromTaskOptions object itself. + */ + public FileGetFromTaskOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the FileGetFromTaskOptions object itself. + */ + public FileGetFromTaskOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the FileGetFromTaskOptions object itself. + */ + public FileGetFromTaskOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get the byte range to be retrieved. The default is to retrieve the entire file. The format is bytes=startRange-endRange. + * + * @return the ocpRange value + */ + public String ocpRange() { + return this.ocpRange; + } + + /** + * Set the byte range to be retrieved. The default is to retrieve the entire file. The format is bytes=startRange-endRange. + * + * @param ocpRange the ocpRange value to set + * @return the FileGetFromTaskOptions object itself. + */ + public FileGetFromTaskOptions withOcpRange(String ocpRange) { + this.ocpRange = ocpRange; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the FileGetFromTaskOptions object itself. + */ + public FileGetFromTaskOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the FileGetFromTaskOptions object itself. + */ + public FileGetFromTaskOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromComputeNodeHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromComputeNodeHeaders.java new file mode 100644 index 000000000000..8356836bb220 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromComputeNodeHeaders.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetPropertiesFromComputeNode operation. + */ +public class FileGetPropertiesFromComputeNodeHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The file creation time. + */ + @JsonProperty(value = "ocp-creation-time") + private DateTimeRfc1123 ocpCreationTime; + + /** + * Whether the object represents a directory. + */ + @JsonProperty(value = "ocp-batch-file-isdirectory") + private Boolean ocpBatchFileIsdirectory; + + /** + * The URL of the file. + */ + @JsonProperty(value = "ocp-batch-file-url") + private String ocpBatchFileUrl; + + /** + * The file mode attribute in octal format. + */ + @JsonProperty(value = "ocp-batch-file-mode") + private String ocpBatchFileMode; + + /** + * The content type of the file. + */ + @JsonProperty(value = "Content-Type") + private String contentType; + + /** + * The length of the file. + */ + @JsonProperty(value = "Content-Length") + private Long contentLength; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileGetPropertiesFromComputeNodeHeaders object itself. + */ + public FileGetPropertiesFromComputeNodeHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the FileGetPropertiesFromComputeNodeHeaders object itself. + */ + public FileGetPropertiesFromComputeNodeHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the FileGetPropertiesFromComputeNodeHeaders object itself. + */ + public FileGetPropertiesFromComputeNodeHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the FileGetPropertiesFromComputeNodeHeaders object itself. + */ + public FileGetPropertiesFromComputeNodeHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the file creation time. + * + * @return the ocpCreationTime value + */ + public DateTime ocpCreationTime() { + if (this.ocpCreationTime == null) { + return null; + } + return this.ocpCreationTime.dateTime(); + } + + /** + * Set the file creation time. + * + * @param ocpCreationTime the ocpCreationTime value to set + * @return the FileGetPropertiesFromComputeNodeHeaders object itself. + */ + public FileGetPropertiesFromComputeNodeHeaders withOcpCreationTime(DateTime ocpCreationTime) { + if (ocpCreationTime == null) { + this.ocpCreationTime = null; + } else { + this.ocpCreationTime = new DateTimeRfc1123(ocpCreationTime); + } + return this; + } + + /** + * Get whether the object represents a directory. + * + * @return the ocpBatchFileIsdirectory value + */ + public Boolean ocpBatchFileIsdirectory() { + return this.ocpBatchFileIsdirectory; + } + + /** + * Set whether the object represents a directory. + * + * @param ocpBatchFileIsdirectory the ocpBatchFileIsdirectory value to set + * @return the FileGetPropertiesFromComputeNodeHeaders object itself. + */ + public FileGetPropertiesFromComputeNodeHeaders withOcpBatchFileIsdirectory(Boolean ocpBatchFileIsdirectory) { + this.ocpBatchFileIsdirectory = ocpBatchFileIsdirectory; + return this; + } + + /** + * Get the URL of the file. + * + * @return the ocpBatchFileUrl value + */ + public String ocpBatchFileUrl() { + return this.ocpBatchFileUrl; + } + + /** + * Set the URL of the file. + * + * @param ocpBatchFileUrl the ocpBatchFileUrl value to set + * @return the FileGetPropertiesFromComputeNodeHeaders object itself. + */ + public FileGetPropertiesFromComputeNodeHeaders withOcpBatchFileUrl(String ocpBatchFileUrl) { + this.ocpBatchFileUrl = ocpBatchFileUrl; + return this; + } + + /** + * Get the file mode attribute in octal format. + * + * @return the ocpBatchFileMode value + */ + public String ocpBatchFileMode() { + return this.ocpBatchFileMode; + } + + /** + * Set the file mode attribute in octal format. + * + * @param ocpBatchFileMode the ocpBatchFileMode value to set + * @return the FileGetPropertiesFromComputeNodeHeaders object itself. + */ + public FileGetPropertiesFromComputeNodeHeaders withOcpBatchFileMode(String ocpBatchFileMode) { + this.ocpBatchFileMode = ocpBatchFileMode; + return this; + } + + /** + * Get the content type of the file. + * + * @return the contentType value + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the content type of the file. + * + * @param contentType the contentType value to set + * @return the FileGetPropertiesFromComputeNodeHeaders object itself. + */ + public FileGetPropertiesFromComputeNodeHeaders withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the length of the file. + * + * @return the contentLength value + */ + public Long contentLength() { + return this.contentLength; + } + + /** + * Set the length of the file. + * + * @param contentLength the contentLength value to set + * @return the FileGetPropertiesFromComputeNodeHeaders object itself. + */ + public FileGetPropertiesFromComputeNodeHeaders withContentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromComputeNodeOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromComputeNodeOptions.java new file mode 100644 index 000000000000..16db0bc9d5d8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromComputeNodeOptions.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for getPropertiesFromComputeNode operation. + */ +public class FileGetPropertiesFromComputeNodeOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the FileGetPropertiesFromComputeNodeOptions object itself. + */ + public FileGetPropertiesFromComputeNodeOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileGetPropertiesFromComputeNodeOptions object itself. + */ + public FileGetPropertiesFromComputeNodeOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the FileGetPropertiesFromComputeNodeOptions object itself. + */ + public FileGetPropertiesFromComputeNodeOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the FileGetPropertiesFromComputeNodeOptions object itself. + */ + public FileGetPropertiesFromComputeNodeOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the FileGetPropertiesFromComputeNodeOptions object itself. + */ + public FileGetPropertiesFromComputeNodeOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the FileGetPropertiesFromComputeNodeOptions object itself. + */ + public FileGetPropertiesFromComputeNodeOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromTaskHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromTaskHeaders.java new file mode 100644 index 000000000000..a40f46d85da1 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromTaskHeaders.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetPropertiesFromTask operation. + */ +public class FileGetPropertiesFromTaskHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The file creation time. + */ + @JsonProperty(value = "ocp-creation-time") + private DateTimeRfc1123 ocpCreationTime; + + /** + * Whether the object represents a directory. + */ + @JsonProperty(value = "ocp-batch-file-isdirectory") + private Boolean ocpBatchFileIsdirectory; + + /** + * The URL of the file. + */ + @JsonProperty(value = "ocp-batch-file-url") + private String ocpBatchFileUrl; + + /** + * The file mode attribute in octal format. + */ + @JsonProperty(value = "ocp-batch-file-mode") + private String ocpBatchFileMode; + + /** + * The content type of the file. + */ + @JsonProperty(value = "Content-Type") + private String contentType; + + /** + * The length of the file. + */ + @JsonProperty(value = "Content-Length") + private Long contentLength; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileGetPropertiesFromTaskHeaders object itself. + */ + public FileGetPropertiesFromTaskHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the FileGetPropertiesFromTaskHeaders object itself. + */ + public FileGetPropertiesFromTaskHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the FileGetPropertiesFromTaskHeaders object itself. + */ + public FileGetPropertiesFromTaskHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the FileGetPropertiesFromTaskHeaders object itself. + */ + public FileGetPropertiesFromTaskHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the file creation time. + * + * @return the ocpCreationTime value + */ + public DateTime ocpCreationTime() { + if (this.ocpCreationTime == null) { + return null; + } + return this.ocpCreationTime.dateTime(); + } + + /** + * Set the file creation time. + * + * @param ocpCreationTime the ocpCreationTime value to set + * @return the FileGetPropertiesFromTaskHeaders object itself. + */ + public FileGetPropertiesFromTaskHeaders withOcpCreationTime(DateTime ocpCreationTime) { + if (ocpCreationTime == null) { + this.ocpCreationTime = null; + } else { + this.ocpCreationTime = new DateTimeRfc1123(ocpCreationTime); + } + return this; + } + + /** + * Get whether the object represents a directory. + * + * @return the ocpBatchFileIsdirectory value + */ + public Boolean ocpBatchFileIsdirectory() { + return this.ocpBatchFileIsdirectory; + } + + /** + * Set whether the object represents a directory. + * + * @param ocpBatchFileIsdirectory the ocpBatchFileIsdirectory value to set + * @return the FileGetPropertiesFromTaskHeaders object itself. + */ + public FileGetPropertiesFromTaskHeaders withOcpBatchFileIsdirectory(Boolean ocpBatchFileIsdirectory) { + this.ocpBatchFileIsdirectory = ocpBatchFileIsdirectory; + return this; + } + + /** + * Get the URL of the file. + * + * @return the ocpBatchFileUrl value + */ + public String ocpBatchFileUrl() { + return this.ocpBatchFileUrl; + } + + /** + * Set the URL of the file. + * + * @param ocpBatchFileUrl the ocpBatchFileUrl value to set + * @return the FileGetPropertiesFromTaskHeaders object itself. + */ + public FileGetPropertiesFromTaskHeaders withOcpBatchFileUrl(String ocpBatchFileUrl) { + this.ocpBatchFileUrl = ocpBatchFileUrl; + return this; + } + + /** + * Get the file mode attribute in octal format. + * + * @return the ocpBatchFileMode value + */ + public String ocpBatchFileMode() { + return this.ocpBatchFileMode; + } + + /** + * Set the file mode attribute in octal format. + * + * @param ocpBatchFileMode the ocpBatchFileMode value to set + * @return the FileGetPropertiesFromTaskHeaders object itself. + */ + public FileGetPropertiesFromTaskHeaders withOcpBatchFileMode(String ocpBatchFileMode) { + this.ocpBatchFileMode = ocpBatchFileMode; + return this; + } + + /** + * Get the content type of the file. + * + * @return the contentType value + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the content type of the file. + * + * @param contentType the contentType value to set + * @return the FileGetPropertiesFromTaskHeaders object itself. + */ + public FileGetPropertiesFromTaskHeaders withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the length of the file. + * + * @return the contentLength value + */ + public Long contentLength() { + return this.contentLength; + } + + /** + * Set the length of the file. + * + * @param contentLength the contentLength value to set + * @return the FileGetPropertiesFromTaskHeaders object itself. + */ + public FileGetPropertiesFromTaskHeaders withContentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromTaskOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromTaskOptions.java new file mode 100644 index 000000000000..7ad7fd329117 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileGetPropertiesFromTaskOptions.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for getPropertiesFromTask operation. + */ +public class FileGetPropertiesFromTaskOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the FileGetPropertiesFromTaskOptions object itself. + */ + public FileGetPropertiesFromTaskOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileGetPropertiesFromTaskOptions object itself. + */ + public FileGetPropertiesFromTaskOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the FileGetPropertiesFromTaskOptions object itself. + */ + public FileGetPropertiesFromTaskOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the FileGetPropertiesFromTaskOptions object itself. + */ + public FileGetPropertiesFromTaskOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the FileGetPropertiesFromTaskOptions object itself. + */ + public FileGetPropertiesFromTaskOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the FileGetPropertiesFromTaskOptions object itself. + */ + public FileGetPropertiesFromTaskOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromComputeNodeHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromComputeNodeHeaders.java new file mode 100644 index 000000000000..5e9071ac3915 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromComputeNodeHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for ListFromComputeNode operation. + */ +public class FileListFromComputeNodeHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileListFromComputeNodeHeaders object itself. + */ + public FileListFromComputeNodeHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the FileListFromComputeNodeHeaders object itself. + */ + public FileListFromComputeNodeHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the FileListFromComputeNodeHeaders object itself. + */ + public FileListFromComputeNodeHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the FileListFromComputeNodeHeaders object itself. + */ + public FileListFromComputeNodeHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromComputeNodeNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromComputeNodeNextOptions.java new file mode 100644 index 000000000000..9de7b8bb984a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromComputeNodeNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listFromComputeNodeNext operation. + */ +public class FileListFromComputeNodeNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileListFromComputeNodeNextOptions object itself. + */ + public FileListFromComputeNodeNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the FileListFromComputeNodeNextOptions object itself. + */ + public FileListFromComputeNodeNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the FileListFromComputeNodeNextOptions object itself. + */ + public FileListFromComputeNodeNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromComputeNodeOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromComputeNodeOptions.java new file mode 100644 index 000000000000..ce6080caa826 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromComputeNodeOptions.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listFromComputeNode operation. + */ +public class FileListFromComputeNodeOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files. + */ + @JsonProperty(value = "") + private String filter; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * files can be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files. + * + * @param filter the filter value to set + * @return the FileListFromComputeNodeOptions object itself. + */ + public FileListFromComputeNodeOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 files can be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 files can be returned. + * + * @param maxResults the maxResults value to set + * @return the FileListFromComputeNodeOptions object itself. + */ + public FileListFromComputeNodeOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the FileListFromComputeNodeOptions object itself. + */ + public FileListFromComputeNodeOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileListFromComputeNodeOptions object itself. + */ + public FileListFromComputeNodeOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the FileListFromComputeNodeOptions object itself. + */ + public FileListFromComputeNodeOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the FileListFromComputeNodeOptions object itself. + */ + public FileListFromComputeNodeOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromTaskHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromTaskHeaders.java new file mode 100644 index 000000000000..b21602a24f45 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromTaskHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for ListFromTask operation. + */ +public class FileListFromTaskHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileListFromTaskHeaders object itself. + */ + public FileListFromTaskHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the FileListFromTaskHeaders object itself. + */ + public FileListFromTaskHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the FileListFromTaskHeaders object itself. + */ + public FileListFromTaskHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the FileListFromTaskHeaders object itself. + */ + public FileListFromTaskHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromTaskNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromTaskNextOptions.java new file mode 100644 index 000000000000..997440fa8da3 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromTaskNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listFromTaskNext operation. + */ +public class FileListFromTaskNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileListFromTaskNextOptions object itself. + */ + public FileListFromTaskNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the FileListFromTaskNextOptions object itself. + */ + public FileListFromTaskNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the FileListFromTaskNextOptions object itself. + */ + public FileListFromTaskNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromTaskOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromTaskOptions.java new file mode 100644 index 000000000000..1fb5a755ce95 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileListFromTaskOptions.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listFromTask operation. + */ +public class FileListFromTaskOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files. + */ + @JsonProperty(value = "") + private String filter; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * files can be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files. + * + * @param filter the filter value to set + * @return the FileListFromTaskOptions object itself. + */ + public FileListFromTaskOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 files can be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 files can be returned. + * + * @param maxResults the maxResults value to set + * @return the FileListFromTaskOptions object itself. + */ + public FileListFromTaskOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the FileListFromTaskOptions object itself. + */ + public FileListFromTaskOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the FileListFromTaskOptions object itself. + */ + public FileListFromTaskOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the FileListFromTaskOptions object itself. + */ + public FileListFromTaskOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the FileListFromTaskOptions object itself. + */ + public FileListFromTaskOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileProperties.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileProperties.java new file mode 100644 index 000000000000..b2ea9ef9d5b2 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/FileProperties.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of a file on a compute node. + */ +public class FileProperties { + /** + * The file creation time. + * The creation time is not returned for files on Linux compute nodes. + */ + @JsonProperty(value = "creationTime") + private DateTime creationTime; + + /** + * The time at which the file was last modified. + */ + @JsonProperty(value = "lastModified", required = true) + private DateTime lastModified; + + /** + * The length of the file. + */ + @JsonProperty(value = "contentLength", required = true) + private long contentLength; + + /** + * The content type of the file. + */ + @JsonProperty(value = "contentType") + private String contentType; + + /** + * The file mode attribute in octal format. + * The file mode is returned only for files on Linux compute nodes. + */ + @JsonProperty(value = "fileMode") + private String fileMode; + + /** + * Get the creation time is not returned for files on Linux compute nodes. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + + /** + * Set the creation time is not returned for files on Linux compute nodes. + * + * @param creationTime the creationTime value to set + * @return the FileProperties object itself. + */ + public FileProperties withCreationTime(DateTime creationTime) { + this.creationTime = creationTime; + return this; + } + + /** + * Get the lastModified value. + * + * @return the lastModified value + */ + public DateTime lastModified() { + return this.lastModified; + } + + /** + * Set the lastModified value. + * + * @param lastModified the lastModified value to set + * @return the FileProperties object itself. + */ + public FileProperties withLastModified(DateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * Get the contentLength value. + * + * @return the contentLength value + */ + public long contentLength() { + return this.contentLength; + } + + /** + * Set the contentLength value. + * + * @param contentLength the contentLength value to set + * @return the FileProperties object itself. + */ + public FileProperties withContentLength(long contentLength) { + this.contentLength = contentLength; + return this; + } + + /** + * Get the contentType value. + * + * @return the contentType value + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the contentType value. + * + * @param contentType the contentType value to set + * @return the FileProperties object itself. + */ + public FileProperties withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the file mode is returned only for files on Linux compute nodes. + * + * @return the fileMode value + */ + public String fileMode() { + return this.fileMode; + } + + /** + * Set the file mode is returned only for files on Linux compute nodes. + * + * @param fileMode the fileMode value to set + * @return the FileProperties object itself. + */ + public FileProperties withFileMode(String fileMode) { + this.fileMode = fileMode; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ImageReference.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ImageReference.java new file mode 100644 index 000000000000..c5f1b3cd0536 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ImageReference.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A reference to an Azure Virtual Machines Marketplace image or a custom Azure + * Virtual Machine image. To get the list of all Azure Marketplace image + * references verified by Azure Batch, see the 'List node agent SKUs' + * operation. + */ +public class ImageReference { + /** + * The publisher of the Azure Virtual Machines Marketplace image. + * For example, Canonical or MicrosoftWindowsServer. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /** + * The offer type of the Azure Virtual Machines Marketplace image. + * For example, UbuntuServer or WindowsServer. + */ + @JsonProperty(value = "offer") + private String offer; + + /** + * The SKU of the Azure Virtual Machines Marketplace image. + * For example, 14.04.0-LTS or 2012-R2-Datacenter. + */ + @JsonProperty(value = "sku") + private String sku; + + /** + * The version of the Azure Virtual Machines Marketplace image. + * A value of 'latest' can be specified to select the latest version of an + * image. If omitted, the default is 'latest'. + */ + @JsonProperty(value = "version") + private String version; + + /** + * The ARM resource identifier of the virtual machine image. Computes nodes + * of the pool will be created using this custom image. This is of the form + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}. + * This property is mutually exclusive with other ImageReference + * properties. The virtual machine image must be in the same region and + * subscription as the Azure Batch account. For more details, see + * https://docs.microsoft.com/azure/batch/batch-custom-images. + */ + @JsonProperty(value = "virtualMachineImageId") + private String virtualMachineImageId; + + /** + * Get for example, Canonical or MicrosoftWindowsServer. + * + * @return the publisher value + */ + public String publisher() { + return this.publisher; + } + + /** + * Set for example, Canonical or MicrosoftWindowsServer. + * + * @param publisher the publisher value to set + * @return the ImageReference object itself. + */ + public ImageReference withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get for example, UbuntuServer or WindowsServer. + * + * @return the offer value + */ + public String offer() { + return this.offer; + } + + /** + * Set for example, UbuntuServer or WindowsServer. + * + * @param offer the offer value to set + * @return the ImageReference object itself. + */ + public ImageReference withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Get for example, 14.04.0-LTS or 2012-R2-Datacenter. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Set for example, 14.04.0-LTS or 2012-R2-Datacenter. + * + * @param sku the sku value to set + * @return the ImageReference object itself. + */ + public ImageReference withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get a value of 'latest' can be specified to select the latest version of an image. If omitted, the default is 'latest'. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set a value of 'latest' can be specified to select the latest version of an image. If omitted, the default is 'latest'. + * + * @param version the version value to set + * @return the ImageReference object itself. + */ + public ImageReference withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get this property is mutually exclusive with other ImageReference properties. The virtual machine image must be in the same region and subscription as the Azure Batch account. For more details, see https://docs.microsoft.com/azure/batch/batch-custom-images. + * + * @return the virtualMachineImageId value + */ + public String virtualMachineImageId() { + return this.virtualMachineImageId; + } + + /** + * Set this property is mutually exclusive with other ImageReference properties. The virtual machine image must be in the same region and subscription as the Azure Batch account. For more details, see https://docs.microsoft.com/azure/batch/batch-custom-images. + * + * @param virtualMachineImageId the virtualMachineImageId value to set + * @return the ImageReference object itself. + */ + public ImageReference withVirtualMachineImageId(String virtualMachineImageId) { + this.virtualMachineImageId = virtualMachineImageId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/InboundEndpoint.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/InboundEndpoint.java new file mode 100644 index 000000000000..70a1d9a7b1bb --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/InboundEndpoint.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An inbound endpoint on a compute node. + */ +public class InboundEndpoint { + /** + * The name of the endpoint. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The protocol of the endpoint. + * Possible values include: 'tcp', 'udp'. + */ + @JsonProperty(value = "protocol", required = true) + private InboundEndpointProtocol protocol; + + /** + * The public IP address of the compute node. + */ + @JsonProperty(value = "publicIPAddress", required = true) + private String publicIPAddress; + + /** + * The public fully qualified domain name for the compute node. + */ + @JsonProperty(value = "publicFQDN", required = true) + private String publicFQDN; + + /** + * The public port number of the endpoint. + */ + @JsonProperty(value = "frontendPort", required = true) + private int frontendPort; + + /** + * The backend port number of the endpoint. + */ + @JsonProperty(value = "backendPort", required = true) + private int backendPort; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the InboundEndpoint object itself. + */ + public InboundEndpoint withName(String name) { + this.name = name; + return this; + } + + /** + * Get possible values include: 'tcp', 'udp'. + * + * @return the protocol value + */ + public InboundEndpointProtocol protocol() { + return this.protocol; + } + + /** + * Set possible values include: 'tcp', 'udp'. + * + * @param protocol the protocol value to set + * @return the InboundEndpoint object itself. + */ + public InboundEndpoint withProtocol(InboundEndpointProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get the publicIPAddress value. + * + * @return the publicIPAddress value + */ + public String publicIPAddress() { + return this.publicIPAddress; + } + + /** + * Set the publicIPAddress value. + * + * @param publicIPAddress the publicIPAddress value to set + * @return the InboundEndpoint object itself. + */ + public InboundEndpoint withPublicIPAddress(String publicIPAddress) { + this.publicIPAddress = publicIPAddress; + return this; + } + + /** + * Get the publicFQDN value. + * + * @return the publicFQDN value + */ + public String publicFQDN() { + return this.publicFQDN; + } + + /** + * Set the publicFQDN value. + * + * @param publicFQDN the publicFQDN value to set + * @return the InboundEndpoint object itself. + */ + public InboundEndpoint withPublicFQDN(String publicFQDN) { + this.publicFQDN = publicFQDN; + return this; + } + + /** + * Get the frontendPort value. + * + * @return the frontendPort value + */ + public int frontendPort() { + return this.frontendPort; + } + + /** + * Set the frontendPort value. + * + * @param frontendPort the frontendPort value to set + * @return the InboundEndpoint object itself. + */ + public InboundEndpoint withFrontendPort(int frontendPort) { + this.frontendPort = frontendPort; + return this; + } + + /** + * Get the backendPort value. + * + * @return the backendPort value + */ + public int backendPort() { + return this.backendPort; + } + + /** + * Set the backendPort value. + * + * @param backendPort the backendPort value to set + * @return the InboundEndpoint object itself. + */ + public InboundEndpoint withBackendPort(int backendPort) { + this.backendPort = backendPort; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/InboundEndpointProtocol.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/InboundEndpointProtocol.java new file mode 100644 index 000000000000..87fd381db231 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/InboundEndpointProtocol.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for InboundEndpointProtocol. + */ +public enum InboundEndpointProtocol { + /** Use TCP for the endpoint. */ + TCP("tcp"), + + /** Use UDP for the endpoint. */ + UDP("udp"); + + /** The actual serialized value for a InboundEndpointProtocol instance. */ + private String value; + + InboundEndpointProtocol(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a InboundEndpointProtocol instance. + * + * @param value the serialized value to parse. + * @return the parsed InboundEndpointProtocol object, or null if unable to parse. + */ + @JsonCreator + public static InboundEndpointProtocol fromString(String value) { + InboundEndpointProtocol[] items = InboundEndpointProtocol.values(); + for (InboundEndpointProtocol item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/InboundNATPool.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/InboundNATPool.java new file mode 100644 index 000000000000..d0a534ef40a9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/InboundNATPool.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A inbound NAT pool that can be used to address specific ports on compute + * nodes in a Batch pool externally. + */ +public class InboundNATPool { + /** + * The name of the endpoint. + * The name must be unique within a Batch pool, can contain letters, + * numbers, underscores, periods, and hyphens. Names must start with a + * letter or number, must end with a letter, number, or underscore, and + * cannot exceed 77 characters. If any invalid values are provided the + * request fails with HTTP status code 400. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The protocol of the endpoint. + * Possible values include: 'tcp', 'udp'. + */ + @JsonProperty(value = "protocol", required = true) + private InboundEndpointProtocol protocol; + + /** + * The port number on the compute node. + * This must be unique within a Batch pool. Acceptable values are between 1 + * and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If + * any reserved values are provided the request fails with HTTP status code + * 400. + */ + @JsonProperty(value = "backendPort", required = true) + private int backendPort; + + /** + * The first port number in the range of external ports that will be used + * to provide inbound access to the backendPort on individual compute + * nodes. + * Acceptable values range between 1 and 65534 except ports from 50000 to + * 55000 which are reserved. All ranges within a pool must be distinct and + * cannot overlap. Each range must contain at least 40 ports. If any + * reserved or overlapping values are provided the request fails with HTTP + * status code 400. + */ + @JsonProperty(value = "frontendPortRangeStart", required = true) + private int frontendPortRangeStart; + + /** + * The last port number in the range of external ports that will be used to + * provide inbound access to the backendPort on individual compute nodes. + * Acceptable values range between 1 and 65534 except ports from 50000 to + * 55000 which are reserved by the Batch service. All ranges within a pool + * must be distinct and cannot overlap. Each range must contain at least 40 + * ports. If any reserved or overlapping values are provided the request + * fails with HTTP status code 400. + */ + @JsonProperty(value = "frontendPortRangeEnd", required = true) + private int frontendPortRangeEnd; + + /** + * A list of network security group rules that will be applied to the + * endpoint. + * The maximum number of rules that can be specified across all the + * endpoints on a Batch pool is 25. If no network security group rules are + * specified, a default rule will be created to allow inbound access to the + * specified backendPort. If the maximum number of network security group + * rules is exceeded the request fails with HTTP status code 400. + */ + @JsonProperty(value = "networkSecurityGroupRules") + private List networkSecurityGroupRules; + + /** + * Get the name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. + * + * @param name the name value to set + * @return the InboundNATPool object itself. + */ + public InboundNATPool withName(String name) { + this.name = name; + return this; + } + + /** + * Get possible values include: 'tcp', 'udp'. + * + * @return the protocol value + */ + public InboundEndpointProtocol protocol() { + return this.protocol; + } + + /** + * Set possible values include: 'tcp', 'udp'. + * + * @param protocol the protocol value to set + * @return the InboundNATPool object itself. + */ + public InboundNATPool withProtocol(InboundEndpointProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get this must be unique within a Batch pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. + * + * @return the backendPort value + */ + public int backendPort() { + return this.backendPort; + } + + /** + * Set this must be unique within a Batch pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. + * + * @param backendPort the backendPort value to set + * @return the InboundNATPool object itself. + */ + public InboundNATPool withBackendPort(int backendPort) { + this.backendPort = backendPort; + return this; + } + + /** + * Get acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a pool must be distinct and cannot overlap. Each range must contain at least 40 ports. If any reserved or overlapping values are provided the request fails with HTTP status code 400. + * + * @return the frontendPortRangeStart value + */ + public int frontendPortRangeStart() { + return this.frontendPortRangeStart; + } + + /** + * Set acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a pool must be distinct and cannot overlap. Each range must contain at least 40 ports. If any reserved or overlapping values are provided the request fails with HTTP status code 400. + * + * @param frontendPortRangeStart the frontendPortRangeStart value to set + * @return the InboundNATPool object itself. + */ + public InboundNATPool withFrontendPortRangeStart(int frontendPortRangeStart) { + this.frontendPortRangeStart = frontendPortRangeStart; + return this; + } + + /** + * Get acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. Each range must contain at least 40 ports. If any reserved or overlapping values are provided the request fails with HTTP status code 400. + * + * @return the frontendPortRangeEnd value + */ + public int frontendPortRangeEnd() { + return this.frontendPortRangeEnd; + } + + /** + * Set acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. Each range must contain at least 40 ports. If any reserved or overlapping values are provided the request fails with HTTP status code 400. + * + * @param frontendPortRangeEnd the frontendPortRangeEnd value to set + * @return the InboundNATPool object itself. + */ + public InboundNATPool withFrontendPortRangeEnd(int frontendPortRangeEnd) { + this.frontendPortRangeEnd = frontendPortRangeEnd; + return this; + } + + /** + * Get the maximum number of rules that can be specified across all the endpoints on a Batch pool is 25. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. If the maximum number of network security group rules is exceeded the request fails with HTTP status code 400. + * + * @return the networkSecurityGroupRules value + */ + public List networkSecurityGroupRules() { + return this.networkSecurityGroupRules; + } + + /** + * Set the maximum number of rules that can be specified across all the endpoints on a Batch pool is 25. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. If the maximum number of network security group rules is exceeded the request fails with HTTP status code 400. + * + * @param networkSecurityGroupRules the networkSecurityGroupRules value to set + * @return the InboundNATPool object itself. + */ + public InboundNATPool withNetworkSecurityGroupRules(List networkSecurityGroupRules) { + this.networkSecurityGroupRules = networkSecurityGroupRules; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAction.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAction.java new file mode 100644 index 000000000000..58d1a452bd7c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAction.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobAction. + */ +public enum JobAction { + /** Take no action. */ + NONE("none"), + + /** Disable the job. This is equivalent to calling the disable job API, with a disableTasks value of requeue. */ + DISABLE("disable"), + + /** Terminate the job. The terminateReason in the job's executionInfo is set to "TaskFailed". */ + TERMINATE("terminate"); + + /** The actual serialized value for a JobAction instance. */ + private String value; + + JobAction(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobAction instance. + * + * @param value the serialized value to parse. + * @return the parsed JobAction object, or null if unable to parse. + */ + @JsonCreator + public static JobAction fromString(String value) { + JobAction[] items = JobAction.values(); + for (JobAction item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAddHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAddHeaders.java new file mode 100644 index 000000000000..3f620cec356c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAddHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Add operation. + */ +public class JobAddHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobAddHeaders object itself. + */ + public JobAddHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobAddHeaders object itself. + */ + public JobAddHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobAddHeaders object itself. + */ + public JobAddHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobAddHeaders object itself. + */ + public JobAddHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobAddHeaders object itself. + */ + public JobAddHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAddOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAddOptions.java new file mode 100644 index 000000000000..d4f9878b4cc6 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAddOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for add operation. + */ +public class JobAddOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobAddOptions object itself. + */ + public JobAddOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobAddOptions object itself. + */ + public JobAddOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobAddOptions object itself. + */ + public JobAddOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobAddOptions object itself. + */ + public JobAddOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAddParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAddParameter.java new file mode 100644 index 000000000000..7106f168b81d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobAddParameter.java @@ -0,0 +1,429 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Azure Batch job to add. + */ +public class JobAddParameter { + /** + * A string that uniquely identifies the job within the account. + * The ID can contain any combination of alphanumeric characters including + * hyphens and underscores, and cannot contain more than 64 characters. The + * ID is case-preserving and case-insensitive (that is, you may not have + * two IDs within an account that differ only by case). + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The display name for the job. + * The display name need not be unique and can contain any Unicode + * characters up to a maximum length of 1024. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The priority of the job. + * Priority values can range from -1000 to 1000, with -1000 being the + * lowest priority and 1000 being the highest priority. The default value + * is 0. + */ + @JsonProperty(value = "priority") + private Integer priority; + + /** + * The execution constraints for the job. + */ + @JsonProperty(value = "constraints") + private JobConstraints constraints; + + /** + * Details of a Job Manager task to be launched when the job is started. + * If the job does not specify a Job Manager task, the user must explicitly + * add tasks to the job. If the job does specify a Job Manager task, the + * Batch service creates the Job Manager task when the job is created, and + * will try to schedule the Job Manager task before scheduling other tasks + * in the job. The Job Manager task's typical purpose is to control and/or + * monitor job execution, for example by deciding what additional tasks to + * run, determining when the work is complete, etc. (However, a Job Manager + * task is not restricted to these activities - it is a fully-fledged task + * in the system and perform whatever actions are required for the job.) + * For example, a Job Manager task might download a file specified as a + * parameter, analyze the contents of that file and submit additional tasks + * based on those contents. + */ + @JsonProperty(value = "jobManagerTask") + private JobManagerTask jobManagerTask; + + /** + * The Job Preparation task. + * If a job has a Job Preparation task, the Batch service will run the Job + * Preparation task on a compute node before starting any tasks of that job + * on that compute node. + */ + @JsonProperty(value = "jobPreparationTask") + private JobPreparationTask jobPreparationTask; + + /** + * The Job Release task. + * A Job Release task cannot be specified without also specifying a Job + * Preparation task for the job. The Batch service runs the Job Release + * task on the compute nodes that have run the Job Preparation task. The + * primary purpose of the Job Release task is to undo changes to compute + * nodes made by the Job Preparation task. Example activities include + * deleting local files, or shutting down services that were started as + * part of job preparation. + */ + @JsonProperty(value = "jobReleaseTask") + private JobReleaseTask jobReleaseTask; + + /** + * The list of common environment variable settings. These environment + * variables are set for all tasks in the job (including the Job Manager, + * Job Preparation and Job Release tasks). + * Individual tasks can override an environment setting specified here by + * specifying the same setting name with a different value. + */ + @JsonProperty(value = "commonEnvironmentSettings") + private List commonEnvironmentSettings; + + /** + * The pool on which the Batch service runs the job's tasks. + */ + @JsonProperty(value = "poolInfo", required = true) + private PoolInformation poolInfo; + + /** + * The action the Batch service should take when all tasks in the job are + * in the completed state. + * Note that if a job contains no tasks, then all tasks are considered + * complete. This option is therefore most commonly used with a Job Manager + * task; if you want to use automatic job termination without a Job + * Manager, you should initially set onAllTasksComplete to noaction and + * update the job properties to set onAllTasksComplete to terminatejob once + * you have finished adding tasks. The default is noaction. Possible values + * include: 'noAction', 'terminateJob'. + */ + @JsonProperty(value = "onAllTasksComplete") + private OnAllTasksComplete onAllTasksComplete; + + /** + * The action the Batch service should take when any task in the job fails. + * A task is considered to have failed if has a failureInfo. A failureInfo + * is set if the task completes with a non-zero exit code after exhausting + * its retry count, or if there was an error starting the task, for example + * due to a resource file download error. The default is noaction. Possible + * values include: 'noAction', 'performExitOptionsJobAction'. + */ + @JsonProperty(value = "onTaskFailure") + private OnTaskFailure onTaskFailure; + + /** + * A list of name-value pairs associated with the job as metadata. + * The Batch service does not assign any meaning to metadata; it is solely + * for the use of user code. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Whether tasks in the job can define dependencies on each other. The + * default is false. + */ + @JsonProperty(value = "usesTaskDependencies") + private Boolean usesTaskDependencies; + + /** + * The network configuration for the job. + */ + @JsonProperty(value = "networkConfiguration") + private JobNetworkConfiguration networkConfiguration; + + /** + * Get the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an account that differ only by case). + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an account that differ only by case). + * + * @param id the id value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withId(String id) { + this.id = id; + return this; + } + + /** + * Get the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @param displayName the displayName value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. + * + * @return the priority value + */ + public Integer priority() { + return this.priority; + } + + /** + * Set priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. + * + * @param priority the priority value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get the execution constraints for the job. + * + * @return the constraints value + */ + public JobConstraints constraints() { + return this.constraints; + } + + /** + * Set the execution constraints for the job. + * + * @param constraints the constraints value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withConstraints(JobConstraints constraints) { + this.constraints = constraints; + return this; + } + + /** + * Get if the job does not specify a Job Manager task, the user must explicitly add tasks to the job. If the job does specify a Job Manager task, the Batch service creates the Job Manager task when the job is created, and will try to schedule the Job Manager task before scheduling other tasks in the job. The Job Manager task's typical purpose is to control and/or monitor job execution, for example by deciding what additional tasks to run, determining when the work is complete, etc. (However, a Job Manager task is not restricted to these activities - it is a fully-fledged task in the system and perform whatever actions are required for the job.) For example, a Job Manager task might download a file specified as a parameter, analyze the contents of that file and submit additional tasks based on those contents. + * + * @return the jobManagerTask value + */ + public JobManagerTask jobManagerTask() { + return this.jobManagerTask; + } + + /** + * Set if the job does not specify a Job Manager task, the user must explicitly add tasks to the job. If the job does specify a Job Manager task, the Batch service creates the Job Manager task when the job is created, and will try to schedule the Job Manager task before scheduling other tasks in the job. The Job Manager task's typical purpose is to control and/or monitor job execution, for example by deciding what additional tasks to run, determining when the work is complete, etc. (However, a Job Manager task is not restricted to these activities - it is a fully-fledged task in the system and perform whatever actions are required for the job.) For example, a Job Manager task might download a file specified as a parameter, analyze the contents of that file and submit additional tasks based on those contents. + * + * @param jobManagerTask the jobManagerTask value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withJobManagerTask(JobManagerTask jobManagerTask) { + this.jobManagerTask = jobManagerTask; + return this; + } + + /** + * Get if a job has a Job Preparation task, the Batch service will run the Job Preparation task on a compute node before starting any tasks of that job on that compute node. + * + * @return the jobPreparationTask value + */ + public JobPreparationTask jobPreparationTask() { + return this.jobPreparationTask; + } + + /** + * Set if a job has a Job Preparation task, the Batch service will run the Job Preparation task on a compute node before starting any tasks of that job on that compute node. + * + * @param jobPreparationTask the jobPreparationTask value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withJobPreparationTask(JobPreparationTask jobPreparationTask) { + this.jobPreparationTask = jobPreparationTask; + return this; + } + + /** + * Get a Job Release task cannot be specified without also specifying a Job Preparation task for the job. The Batch service runs the Job Release task on the compute nodes that have run the Job Preparation task. The primary purpose of the Job Release task is to undo changes to compute nodes made by the Job Preparation task. Example activities include deleting local files, or shutting down services that were started as part of job preparation. + * + * @return the jobReleaseTask value + */ + public JobReleaseTask jobReleaseTask() { + return this.jobReleaseTask; + } + + /** + * Set a Job Release task cannot be specified without also specifying a Job Preparation task for the job. The Batch service runs the Job Release task on the compute nodes that have run the Job Preparation task. The primary purpose of the Job Release task is to undo changes to compute nodes made by the Job Preparation task. Example activities include deleting local files, or shutting down services that were started as part of job preparation. + * + * @param jobReleaseTask the jobReleaseTask value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withJobReleaseTask(JobReleaseTask jobReleaseTask) { + this.jobReleaseTask = jobReleaseTask; + return this; + } + + /** + * Get individual tasks can override an environment setting specified here by specifying the same setting name with a different value. + * + * @return the commonEnvironmentSettings value + */ + public List commonEnvironmentSettings() { + return this.commonEnvironmentSettings; + } + + /** + * Set individual tasks can override an environment setting specified here by specifying the same setting name with a different value. + * + * @param commonEnvironmentSettings the commonEnvironmentSettings value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withCommonEnvironmentSettings(List commonEnvironmentSettings) { + this.commonEnvironmentSettings = commonEnvironmentSettings; + return this; + } + + /** + * Get the poolInfo value. + * + * @return the poolInfo value + */ + public PoolInformation poolInfo() { + return this.poolInfo; + } + + /** + * Set the poolInfo value. + * + * @param poolInfo the poolInfo value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withPoolInfo(PoolInformation poolInfo) { + this.poolInfo = poolInfo; + return this; + } + + /** + * Get note that if a job contains no tasks, then all tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the job properties to set onAllTasksComplete to terminatejob once you have finished adding tasks. The default is noaction. Possible values include: 'noAction', 'terminateJob'. + * + * @return the onAllTasksComplete value + */ + public OnAllTasksComplete onAllTasksComplete() { + return this.onAllTasksComplete; + } + + /** + * Set note that if a job contains no tasks, then all tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the job properties to set onAllTasksComplete to terminatejob once you have finished adding tasks. The default is noaction. Possible values include: 'noAction', 'terminateJob'. + * + * @param onAllTasksComplete the onAllTasksComplete value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withOnAllTasksComplete(OnAllTasksComplete onAllTasksComplete) { + this.onAllTasksComplete = onAllTasksComplete; + return this; + } + + /** + * Get a task is considered to have failed if has a failureInfo. A failureInfo is set if the task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the task, for example due to a resource file download error. The default is noaction. Possible values include: 'noAction', 'performExitOptionsJobAction'. + * + * @return the onTaskFailure value + */ + public OnTaskFailure onTaskFailure() { + return this.onTaskFailure; + } + + /** + * Set a task is considered to have failed if has a failureInfo. A failureInfo is set if the task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the task, for example due to a resource file download error. The default is noaction. Possible values include: 'noAction', 'performExitOptionsJobAction'. + * + * @param onTaskFailure the onTaskFailure value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withOnTaskFailure(OnTaskFailure onTaskFailure) { + this.onTaskFailure = onTaskFailure; + return this; + } + + /** + * Get the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @param metadata the metadata value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the usesTaskDependencies value. + * + * @return the usesTaskDependencies value + */ + public Boolean usesTaskDependencies() { + return this.usesTaskDependencies; + } + + /** + * Set the usesTaskDependencies value. + * + * @param usesTaskDependencies the usesTaskDependencies value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withUsesTaskDependencies(Boolean usesTaskDependencies) { + this.usesTaskDependencies = usesTaskDependencies; + return this; + } + + /** + * Get the networkConfiguration value. + * + * @return the networkConfiguration value + */ + public JobNetworkConfiguration networkConfiguration() { + return this.networkConfiguration; + } + + /** + * Set the networkConfiguration value. + * + * @param networkConfiguration the networkConfiguration value to set + * @return the JobAddParameter object itself. + */ + public JobAddParameter withNetworkConfiguration(JobNetworkConfiguration networkConfiguration) { + this.networkConfiguration = networkConfiguration; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobConstraints.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobConstraints.java new file mode 100644 index 000000000000..4de9e7ec150e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobConstraints.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The execution constraints for a job. + */ +public class JobConstraints { + /** + * The maximum elapsed time that the job may run, measured from the time + * the job is created. + * If the job does not complete within the time limit, the Batch service + * terminates it and any tasks that are still running. In this case, the + * termination reason will be MaxWallClockTimeExpiry. If this property is + * not specified, there is no time limit on how long the job may run. + */ + @JsonProperty(value = "maxWallClockTime") + private Period maxWallClockTime; + + /** + * The maximum number of times each task may be retried. The Batch service + * retries a task if its exit code is nonzero. + * Note that this value specifically controls the number of retries. The + * Batch service will try each task once, and may then retry up to this + * limit. For example, if the maximum retry count is 3, Batch tries a task + * up to 4 times (one initial try and 3 retries). If the maximum retry + * count is 0, the Batch service does not retry tasks. If the maximum retry + * count is -1, the Batch service retries tasks without limit. The default + * value is 0 (no retries). + */ + @JsonProperty(value = "maxTaskRetryCount") + private Integer maxTaskRetryCount; + + /** + * Get if the job does not complete within the time limit, the Batch service terminates it and any tasks that are still running. In this case, the termination reason will be MaxWallClockTimeExpiry. If this property is not specified, there is no time limit on how long the job may run. + * + * @return the maxWallClockTime value + */ + public Period maxWallClockTime() { + return this.maxWallClockTime; + } + + /** + * Set if the job does not complete within the time limit, the Batch service terminates it and any tasks that are still running. In this case, the termination reason will be MaxWallClockTimeExpiry. If this property is not specified, there is no time limit on how long the job may run. + * + * @param maxWallClockTime the maxWallClockTime value to set + * @return the JobConstraints object itself. + */ + public JobConstraints withMaxWallClockTime(Period maxWallClockTime) { + this.maxWallClockTime = maxWallClockTime; + return this; + } + + /** + * Get note that this value specifically controls the number of retries. The Batch service will try each task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries a task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry tasks. If the maximum retry count is -1, the Batch service retries tasks without limit. The default value is 0 (no retries). + * + * @return the maxTaskRetryCount value + */ + public Integer maxTaskRetryCount() { + return this.maxTaskRetryCount; + } + + /** + * Set note that this value specifically controls the number of retries. The Batch service will try each task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries a task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry tasks. If the maximum retry count is -1, the Batch service retries tasks without limit. The default value is 0 (no retries). + * + * @param maxTaskRetryCount the maxTaskRetryCount value to set + * @return the JobConstraints object itself. + */ + public JobConstraints withMaxTaskRetryCount(Integer maxTaskRetryCount) { + this.maxTaskRetryCount = maxTaskRetryCount; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDeleteHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDeleteHeaders.java new file mode 100644 index 000000000000..f0bfbdb17197 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDeleteHeaders.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Delete operation. + */ +public class JobDeleteHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private String clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private String requestId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobDeleteHeaders object itself. + */ + public JobDeleteHeaders withClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobDeleteHeaders object itself. + */ + public JobDeleteHeaders withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDeleteOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDeleteOptions.java new file mode 100644 index 000000000000..0f21b4a2293e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDeleteOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for delete operation. + */ +public class JobDeleteOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobDeleteOptions object itself. + */ + public JobDeleteOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobDeleteOptions object itself. + */ + public JobDeleteOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobDeleteOptions object itself. + */ + public JobDeleteOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobDeleteOptions object itself. + */ + public JobDeleteOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobDeleteOptions object itself. + */ + public JobDeleteOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobDeleteOptions object itself. + */ + public JobDeleteOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobDeleteOptions object itself. + */ + public JobDeleteOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobDeleteOptions object itself. + */ + public JobDeleteOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDisableHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDisableHeaders.java new file mode 100644 index 000000000000..b45471202221 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDisableHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Disable operation. + */ +public class JobDisableHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobDisableHeaders object itself. + */ + public JobDisableHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobDisableHeaders object itself. + */ + public JobDisableHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobDisableHeaders object itself. + */ + public JobDisableHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobDisableHeaders object itself. + */ + public JobDisableHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobDisableHeaders object itself. + */ + public JobDisableHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDisableOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDisableOptions.java new file mode 100644 index 000000000000..8a848981ea9f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDisableOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for disable operation. + */ +public class JobDisableOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobDisableOptions object itself. + */ + public JobDisableOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobDisableOptions object itself. + */ + public JobDisableOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobDisableOptions object itself. + */ + public JobDisableOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobDisableOptions object itself. + */ + public JobDisableOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobDisableOptions object itself. + */ + public JobDisableOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobDisableOptions object itself. + */ + public JobDisableOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobDisableOptions object itself. + */ + public JobDisableOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobDisableOptions object itself. + */ + public JobDisableOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDisableParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDisableParameter.java new file mode 100644 index 000000000000..3c7122e1e23f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobDisableParameter.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Options when disabling a job. + */ +public class JobDisableParameter { + /** + * What to do with active tasks associated with the job. + * Possible values include: 'requeue', 'terminate', 'wait'. + */ + @JsonProperty(value = "disableTasks", required = true) + private DisableJobOption disableTasks; + + /** + * Get possible values include: 'requeue', 'terminate', 'wait'. + * + * @return the disableTasks value + */ + public DisableJobOption disableTasks() { + return this.disableTasks; + } + + /** + * Set possible values include: 'requeue', 'terminate', 'wait'. + * + * @param disableTasks the disableTasks value to set + * @return the JobDisableParameter object itself. + */ + public JobDisableParameter withDisableTasks(DisableJobOption disableTasks) { + this.disableTasks = disableTasks; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobEnableHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobEnableHeaders.java new file mode 100644 index 000000000000..9a2c5d5a8667 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobEnableHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Enable operation. + */ +public class JobEnableHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobEnableHeaders object itself. + */ + public JobEnableHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobEnableHeaders object itself. + */ + public JobEnableHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobEnableHeaders object itself. + */ + public JobEnableHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobEnableHeaders object itself. + */ + public JobEnableHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobEnableHeaders object itself. + */ + public JobEnableHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobEnableOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobEnableOptions.java new file mode 100644 index 000000000000..8e02ed02cb76 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobEnableOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for enable operation. + */ +public class JobEnableOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobEnableOptions object itself. + */ + public JobEnableOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobEnableOptions object itself. + */ + public JobEnableOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobEnableOptions object itself. + */ + public JobEnableOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobEnableOptions object itself. + */ + public JobEnableOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobEnableOptions object itself. + */ + public JobEnableOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobEnableOptions object itself. + */ + public JobEnableOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobEnableOptions object itself. + */ + public JobEnableOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobEnableOptions object itself. + */ + public JobEnableOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobExecutionInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobExecutionInformation.java new file mode 100644 index 000000000000..f5d78bdb5cd4 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobExecutionInformation.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about the execution of a job in the Azure Batch + * service. + */ +public class JobExecutionInformation { + /** + * The start time of the job. + * This is the time at which the job was created. + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The completion time of the job. + * This property is set only if the job is in the completed state. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * The ID of the pool to which this job is assigned. + * This element contains the actual pool where the job is assigned. When + * you get job details from the service, they also contain a poolInfo + * element, which contains the pool configuration data from when the job + * was added or updated. That poolInfo element may also contain a poolId + * element. If it does, the two IDs are the same. If it does not, it means + * the job ran on an auto pool, and this property contains the ID of that + * auto pool. + */ + @JsonProperty(value = "poolId") + private String poolId; + + /** + * Details of any error encountered by the service in starting the job. + * This property is not set if there was no error starting the job. + */ + @JsonProperty(value = "schedulingError") + private JobSchedulingError schedulingError; + + /** + * A string describing the reason the job ended. + * This property is set only if the job is in the completed state. If the + * Batch service terminates the job, it sets the reason as follows: + * JMComplete - the Job Manager task completed, and killJobOnCompletion was + * set to true. MaxWallClockTimeExpiry - the job reached its + * maxWallClockTime constraint. TerminateJobSchedule - the job ran as part + * of a schedule, and the schedule terminated. AllTasksComplete - the job's + * onAllTasksComplete attribute is set to terminatejob, and all tasks in + * the job are complete. TaskFailed - the job's onTaskFailure attribute is + * set to performExitOptionsJobAction, and a task in the job failed with an + * exit condition that specified a jobAction of terminatejob. Any other + * string is a user-defined reason specified in a call to the 'Terminate a + * job' operation. + */ + @JsonProperty(value = "terminateReason") + private String terminateReason; + + /** + * Get this is the time at which the job was created. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set this is the time at which the job was created. + * + * @param startTime the startTime value to set + * @return the JobExecutionInformation object itself. + */ + public JobExecutionInformation withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get this property is set only if the job is in the completed state. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set this property is set only if the job is in the completed state. + * + * @param endTime the endTime value to set + * @return the JobExecutionInformation object itself. + */ + public JobExecutionInformation withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get this element contains the actual pool where the job is assigned. When you get job details from the service, they also contain a poolInfo element, which contains the pool configuration data from when the job was added or updated. That poolInfo element may also contain a poolId element. If it does, the two IDs are the same. If it does not, it means the job ran on an auto pool, and this property contains the ID of that auto pool. + * + * @return the poolId value + */ + public String poolId() { + return this.poolId; + } + + /** + * Set this element contains the actual pool where the job is assigned. When you get job details from the service, they also contain a poolInfo element, which contains the pool configuration data from when the job was added or updated. That poolInfo element may also contain a poolId element. If it does, the two IDs are the same. If it does not, it means the job ran on an auto pool, and this property contains the ID of that auto pool. + * + * @param poolId the poolId value to set + * @return the JobExecutionInformation object itself. + */ + public JobExecutionInformation withPoolId(String poolId) { + this.poolId = poolId; + return this; + } + + /** + * Get this property is not set if there was no error starting the job. + * + * @return the schedulingError value + */ + public JobSchedulingError schedulingError() { + return this.schedulingError; + } + + /** + * Set this property is not set if there was no error starting the job. + * + * @param schedulingError the schedulingError value to set + * @return the JobExecutionInformation object itself. + */ + public JobExecutionInformation withSchedulingError(JobSchedulingError schedulingError) { + this.schedulingError = schedulingError; + return this; + } + + /** + * Get this property is set only if the job is in the completed state. If the Batch service terminates the job, it sets the reason as follows: JMComplete - the Job Manager task completed, and killJobOnCompletion was set to true. MaxWallClockTimeExpiry - the job reached its maxWallClockTime constraint. TerminateJobSchedule - the job ran as part of a schedule, and the schedule terminated. AllTasksComplete - the job's onAllTasksComplete attribute is set to terminatejob, and all tasks in the job are complete. TaskFailed - the job's onTaskFailure attribute is set to performExitOptionsJobAction, and a task in the job failed with an exit condition that specified a jobAction of terminatejob. Any other string is a user-defined reason specified in a call to the 'Terminate a job' operation. + * + * @return the terminateReason value + */ + public String terminateReason() { + return this.terminateReason; + } + + /** + * Set this property is set only if the job is in the completed state. If the Batch service terminates the job, it sets the reason as follows: JMComplete - the Job Manager task completed, and killJobOnCompletion was set to true. MaxWallClockTimeExpiry - the job reached its maxWallClockTime constraint. TerminateJobSchedule - the job ran as part of a schedule, and the schedule terminated. AllTasksComplete - the job's onAllTasksComplete attribute is set to terminatejob, and all tasks in the job are complete. TaskFailed - the job's onTaskFailure attribute is set to performExitOptionsJobAction, and a task in the job failed with an exit condition that specified a jobAction of terminatejob. Any other string is a user-defined reason specified in a call to the 'Terminate a job' operation. + * + * @param terminateReason the terminateReason value to set + * @return the JobExecutionInformation object itself. + */ + public JobExecutionInformation withTerminateReason(String terminateReason) { + this.terminateReason = terminateReason; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetAllLifetimeStatisticsHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetAllLifetimeStatisticsHeaders.java new file mode 100644 index 000000000000..971a0037a92a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetAllLifetimeStatisticsHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetAllLifetimeStatistics operation. + */ +public class JobGetAllLifetimeStatisticsHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobGetAllLifetimeStatisticsHeaders object itself. + */ + public JobGetAllLifetimeStatisticsHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobGetAllLifetimeStatisticsHeaders object itself. + */ + public JobGetAllLifetimeStatisticsHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobGetAllLifetimeStatisticsHeaders object itself. + */ + public JobGetAllLifetimeStatisticsHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobGetAllLifetimeStatisticsHeaders object itself. + */ + public JobGetAllLifetimeStatisticsHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetAllLifetimeStatisticsOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetAllLifetimeStatisticsOptions.java new file mode 100644 index 000000000000..0b87277d02f8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetAllLifetimeStatisticsOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for getAllLifetimeStatistics operation. + */ +public class JobGetAllLifetimeStatisticsOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobGetAllLifetimeStatisticsOptions object itself. + */ + public JobGetAllLifetimeStatisticsOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobGetAllLifetimeStatisticsOptions object itself. + */ + public JobGetAllLifetimeStatisticsOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobGetAllLifetimeStatisticsOptions object itself. + */ + public JobGetAllLifetimeStatisticsOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobGetAllLifetimeStatisticsOptions object itself. + */ + public JobGetAllLifetimeStatisticsOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetHeaders.java new file mode 100644 index 000000000000..cff3a574e216 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class JobGetHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobGetHeaders object itself. + */ + public JobGetHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobGetHeaders object itself. + */ + public JobGetHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobGetHeaders object itself. + */ + public JobGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobGetHeaders object itself. + */ + public JobGetHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetOptions.java new file mode 100644 index 000000000000..01f2e83ec370 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetOptions.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for get operation. + */ +public class JobGetOptions { + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * An OData $expand clause. + */ + @JsonProperty(value = "") + private String expand; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the JobGetOptions object itself. + */ + public JobGetOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get an OData $expand clause. + * + * @return the expand value + */ + public String expand() { + return this.expand; + } + + /** + * Set an OData $expand clause. + * + * @param expand the expand value to set + * @return the JobGetOptions object itself. + */ + public JobGetOptions withExpand(String expand) { + this.expand = expand; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobGetOptions object itself. + */ + public JobGetOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobGetOptions object itself. + */ + public JobGetOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobGetOptions object itself. + */ + public JobGetOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobGetOptions object itself. + */ + public JobGetOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobGetOptions object itself. + */ + public JobGetOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobGetOptions object itself. + */ + public JobGetOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobGetOptions object itself. + */ + public JobGetOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobGetOptions object itself. + */ + public JobGetOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetTaskCountsHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetTaskCountsHeaders.java new file mode 100644 index 000000000000..a95c22ed0e23 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetTaskCountsHeaders.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetTaskCounts operation. + */ +public class JobGetTaskCountsHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobGetTaskCountsHeaders object itself. + */ + public JobGetTaskCountsHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobGetTaskCountsHeaders object itself. + */ + public JobGetTaskCountsHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetTaskCountsOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetTaskCountsOptions.java new file mode 100644 index 000000000000..ba0d6057133e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobGetTaskCountsOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for getTaskCounts operation. + */ +public class JobGetTaskCountsOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobGetTaskCountsOptions object itself. + */ + public JobGetTaskCountsOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobGetTaskCountsOptions object itself. + */ + public JobGetTaskCountsOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobGetTaskCountsOptions object itself. + */ + public JobGetTaskCountsOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobGetTaskCountsOptions object itself. + */ + public JobGetTaskCountsOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListFromJobScheduleHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListFromJobScheduleHeaders.java new file mode 100644 index 000000000000..0a5c48a3c0cb --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListFromJobScheduleHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for ListFromJobSchedule operation. + */ +public class JobListFromJobScheduleHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobListFromJobScheduleHeaders object itself. + */ + public JobListFromJobScheduleHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobListFromJobScheduleHeaders object itself. + */ + public JobListFromJobScheduleHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobListFromJobScheduleHeaders object itself. + */ + public JobListFromJobScheduleHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobListFromJobScheduleHeaders object itself. + */ + public JobListFromJobScheduleHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListFromJobScheduleNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListFromJobScheduleNextOptions.java new file mode 100644 index 000000000000..0cea3b295531 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListFromJobScheduleNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listFromJobScheduleNext operation. + */ +public class JobListFromJobScheduleNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobListFromJobScheduleNextOptions object itself. + */ + public JobListFromJobScheduleNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobListFromJobScheduleNextOptions object itself. + */ + public JobListFromJobScheduleNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobListFromJobScheduleNextOptions object itself. + */ + public JobListFromJobScheduleNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListFromJobScheduleOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListFromJobScheduleOptions.java new file mode 100644 index 000000000000..4c8d61b74b11 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListFromJobScheduleOptions.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listFromJobSchedule operation. + */ +public class JobListFromJobScheduleOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs-in-a-job-schedule. + */ + @JsonProperty(value = "") + private String filter; + + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * An OData $expand clause. + */ + @JsonProperty(value = "") + private String expand; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * jobs can be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs-in-a-job-schedule. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs-in-a-job-schedule. + * + * @param filter the filter value to set + * @return the JobListFromJobScheduleOptions object itself. + */ + public JobListFromJobScheduleOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the JobListFromJobScheduleOptions object itself. + */ + public JobListFromJobScheduleOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get an OData $expand clause. + * + * @return the expand value + */ + public String expand() { + return this.expand; + } + + /** + * Set an OData $expand clause. + * + * @param expand the expand value to set + * @return the JobListFromJobScheduleOptions object itself. + */ + public JobListFromJobScheduleOptions withExpand(String expand) { + this.expand = expand; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 jobs can be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 jobs can be returned. + * + * @param maxResults the maxResults value to set + * @return the JobListFromJobScheduleOptions object itself. + */ + public JobListFromJobScheduleOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobListFromJobScheduleOptions object itself. + */ + public JobListFromJobScheduleOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobListFromJobScheduleOptions object itself. + */ + public JobListFromJobScheduleOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobListFromJobScheduleOptions object itself. + */ + public JobListFromJobScheduleOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobListFromJobScheduleOptions object itself. + */ + public JobListFromJobScheduleOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListHeaders.java new file mode 100644 index 000000000000..1181a3f6e3d3 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for List operation. + */ +public class JobListHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobListHeaders object itself. + */ + public JobListHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobListHeaders object itself. + */ + public JobListHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobListHeaders object itself. + */ + public JobListHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobListHeaders object itself. + */ + public JobListHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListNextOptions.java new file mode 100644 index 000000000000..895ad4e2bb63 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listNext operation. + */ +public class JobListNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobListNextOptions object itself. + */ + public JobListNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobListNextOptions object itself. + */ + public JobListNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobListNextOptions object itself. + */ + public JobListNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListOptions.java new file mode 100644 index 000000000000..05e962aea2fd --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListOptions.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for list operation. + */ +public class JobListOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs. + */ + @JsonProperty(value = "") + private String filter; + + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * An OData $expand clause. + */ + @JsonProperty(value = "") + private String expand; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * jobs can be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs. + * + * @param filter the filter value to set + * @return the JobListOptions object itself. + */ + public JobListOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the JobListOptions object itself. + */ + public JobListOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get an OData $expand clause. + * + * @return the expand value + */ + public String expand() { + return this.expand; + } + + /** + * Set an OData $expand clause. + * + * @param expand the expand value to set + * @return the JobListOptions object itself. + */ + public JobListOptions withExpand(String expand) { + this.expand = expand; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 jobs can be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 jobs can be returned. + * + * @param maxResults the maxResults value to set + * @return the JobListOptions object itself. + */ + public JobListOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobListOptions object itself. + */ + public JobListOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobListOptions object itself. + */ + public JobListOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobListOptions object itself. + */ + public JobListOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobListOptions object itself. + */ + public JobListOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListPreparationAndReleaseTaskStatusHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListPreparationAndReleaseTaskStatusHeaders.java new file mode 100644 index 000000000000..ffdd2357bb15 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListPreparationAndReleaseTaskStatusHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for ListPreparationAndReleaseTaskStatus operation. + */ +public class JobListPreparationAndReleaseTaskStatusHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobListPreparationAndReleaseTaskStatusHeaders object itself. + */ + public JobListPreparationAndReleaseTaskStatusHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobListPreparationAndReleaseTaskStatusHeaders object itself. + */ + public JobListPreparationAndReleaseTaskStatusHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobListPreparationAndReleaseTaskStatusHeaders object itself. + */ + public JobListPreparationAndReleaseTaskStatusHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobListPreparationAndReleaseTaskStatusHeaders object itself. + */ + public JobListPreparationAndReleaseTaskStatusHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListPreparationAndReleaseTaskStatusNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListPreparationAndReleaseTaskStatusNextOptions.java new file mode 100644 index 000000000000..f0a49ce350ab --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListPreparationAndReleaseTaskStatusNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listPreparationAndReleaseTaskStatusNext operation. + */ +public class JobListPreparationAndReleaseTaskStatusNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobListPreparationAndReleaseTaskStatusNextOptions object itself. + */ + public JobListPreparationAndReleaseTaskStatusNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobListPreparationAndReleaseTaskStatusNextOptions object itself. + */ + public JobListPreparationAndReleaseTaskStatusNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobListPreparationAndReleaseTaskStatusNextOptions object itself. + */ + public JobListPreparationAndReleaseTaskStatusNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListPreparationAndReleaseTaskStatusOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListPreparationAndReleaseTaskStatusOptions.java new file mode 100644 index 000000000000..b0e2f3274439 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobListPreparationAndReleaseTaskStatusOptions.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listPreparationAndReleaseTaskStatus operation. + */ +public class JobListPreparationAndReleaseTaskStatusOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-preparation-and-release-status. + */ + @JsonProperty(value = "") + private String filter; + + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * tasks can be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-preparation-and-release-status. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-preparation-and-release-status. + * + * @param filter the filter value to set + * @return the JobListPreparationAndReleaseTaskStatusOptions object itself. + */ + public JobListPreparationAndReleaseTaskStatusOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the JobListPreparationAndReleaseTaskStatusOptions object itself. + */ + public JobListPreparationAndReleaseTaskStatusOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 tasks can be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 tasks can be returned. + * + * @param maxResults the maxResults value to set + * @return the JobListPreparationAndReleaseTaskStatusOptions object itself. + */ + public JobListPreparationAndReleaseTaskStatusOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobListPreparationAndReleaseTaskStatusOptions object itself. + */ + public JobListPreparationAndReleaseTaskStatusOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobListPreparationAndReleaseTaskStatusOptions object itself. + */ + public JobListPreparationAndReleaseTaskStatusOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobListPreparationAndReleaseTaskStatusOptions object itself. + */ + public JobListPreparationAndReleaseTaskStatusOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobListPreparationAndReleaseTaskStatusOptions object itself. + */ + public JobListPreparationAndReleaseTaskStatusOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobManagerTask.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobManagerTask.java new file mode 100644 index 000000000000..ca83c3190c20 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobManagerTask.java @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies details of a Job Manager task. + * The Job Manager task is automatically started when the job is created. The + * Batch service tries to schedule the Job Manager task before any other tasks + * in the job. When shrinking a pool, the Batch service tries to preserve + * compute nodes where Job Manager tasks are running for as long as possible + * (that is, nodes running 'normal' tasks are removed before nodes running Job + * Manager tasks). When a Job Manager task fails and needs to be restarted, the + * system tries to schedule it at the highest priority. If there are no idle + * nodes available, the system may terminate one of the running tasks in the + * pool and return it to the queue in order to make room for the Job Manager + * task to restart. Note that a Job Manager task in one job does not have + * priority over tasks in other jobs. Across jobs, only job level priorities + * are observed. For example, if a Job Manager in a priority 0 job needs to be + * restarted, it will not displace tasks of a priority 1 job. Batch will retry + * tasks when a recovery operation is triggered on a compute node. Examples of + * recovery operations include (but are not limited to) when an unhealthy + * compute node is rebooted or a compute node disappeared due to host failure. + * Retries due to recovery operations are independent of and are not counted + * against the maxTaskRetryCount. Even if the maxTaskRetryCount is 0, an + * internal retry due to a recovery operation may occur. Because of this, all + * tasks should be idempotent. This means tasks need to tolerate being + * interrupted and restarted without causing any corruption or duplicate data. + * The best practice for long running tasks is to use some form of + * checkpointing. + */ +public class JobManagerTask { + /** + * A string that uniquely identifies the Job Manager task within the job. + * The ID can contain any combination of alphanumeric characters including + * hyphens and underscores and cannot contain more than 64 characters. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The display name of the Job Manager task. + * It need not be unique and can contain any Unicode characters up to a + * maximum length of 1024. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The command line of the Job Manager task. + * The command line does not run under a shell, and therefore cannot take + * advantage of shell features such as environment variable expansion. If + * you want to take advantage of such features, you should invoke the shell + * in the command line, for example using "cmd /c MyCommand" in Windows or + * "/bin/sh -c MyCommand" in Linux. If the command line refers to file + * paths, it should use a relative path (relative to the task working + * directory), or use the Batch provided environment variable + * (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + */ + @JsonProperty(value = "commandLine", required = true) + private String commandLine; + + /** + * The settings for the container under which the Job Manager task runs. + * If the pool that will run this task has containerConfiguration set, this + * must be set as well. If the pool that will run this task doesn't have + * containerConfiguration set, this must not be set. When this is + * specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR + * (the root of Azure Batch directories on the node) are mapped into the + * container, all task environment variables are mapped into the container, + * and the task command line is executed in the container. + */ + @JsonProperty(value = "containerSettings") + private TaskContainerSettings containerSettings; + + /** + * A list of files that the Batch service will download to the compute node + * before running the command line. + * Files listed under this element are located in the task's working + * directory. There is a maximum size for the list of resource files. When + * the max size is exceeded, the request will fail and the response error + * code will be RequestEntityTooLarge. If this occurs, the collection of + * ResourceFiles must be reduced in size. This can be achieved using .zip + * files, Application Packages, or Docker Containers. + */ + @JsonProperty(value = "resourceFiles") + private List resourceFiles; + + /** + * A list of files that the Batch service will upload from the compute node + * after running the command line. + * For multi-instance tasks, the files will only be uploaded from the + * compute node on which the primary task is executed. + */ + @JsonProperty(value = "outputFiles") + private List outputFiles; + + /** + * A list of environment variable settings for the Job Manager task. + */ + @JsonProperty(value = "environmentSettings") + private List environmentSettings; + + /** + * Constraints that apply to the Job Manager task. + */ + @JsonProperty(value = "constraints") + private TaskConstraints constraints; + + /** + * Whether completion of the Job Manager task signifies completion of the + * entire job. + * If true, when the Job Manager task completes, the Batch service marks + * the job as complete. If any tasks are still running at this time (other + * than Job Release), those tasks are terminated. If false, the completion + * of the Job Manager task does not affect the job status. In this case, + * you should either use the onAllTasksComplete attribute to terminate the + * job, or have a client or user terminate the job explicitly. An example + * of this is if the Job Manager creates a set of tasks but then takes no + * further role in their execution. The default value is true. If you are + * using the onAllTasksComplete and onTaskFailure attributes to control job + * lifetime, and using the Job Manager task only to create the tasks for + * the job (not to monitor progress), then it is important to set + * killJobOnCompletion to false. + */ + @JsonProperty(value = "killJobOnCompletion") + private Boolean killJobOnCompletion; + + /** + * The user identity under which the Job Manager task runs. + * If omitted, the task runs as a non-administrative user unique to the + * task. + */ + @JsonProperty(value = "userIdentity") + private UserIdentity userIdentity; + + /** + * Whether the Job Manager task requires exclusive use of the compute node + * where it runs. + * If true, no other tasks will run on the same compute node for as long as + * the Job Manager is running. If false, other tasks can run simultaneously + * with the Job Manager on a compute node. The Job Manager task counts + * normally against the node's concurrent task limit, so this is only + * relevant if the node allows multiple concurrent tasks. The default value + * is true. + */ + @JsonProperty(value = "runExclusive") + private Boolean runExclusive; + + /** + * A list of application packages that the Batch service will deploy to the + * compute node before running the command line. + * Application packages are downloaded and deployed to a shared directory, + * not the task working directory. Therefore, if a referenced package is + * already on the compute node, and is up to date, then it is not + * re-downloaded; the existing copy on the compute node is used. If a + * referenced application package cannot be installed, for example because + * the package has been deleted or because download failed, the task fails. + */ + @JsonProperty(value = "applicationPackageReferences") + private List applicationPackageReferences; + + /** + * The settings for an authentication token that the task can use to + * perform Batch service operations. + * If this property is set, the Batch service provides the task with an + * authentication token which can be used to authenticate Batch service + * operations without requiring an account access key. The token is + * provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The + * operations that the task can carry out using the token depend on the + * settings. For example, a task can request job permissions in order to + * add other tasks to the job, or check the status of the job or of other + * tasks under the job. + */ + @JsonProperty(value = "authenticationTokenSettings") + private AuthenticationTokenSettings authenticationTokenSettings; + + /** + * Whether the Job Manager task may run on a low-priority compute node. + * The default value is true. + */ + @JsonProperty(value = "allowLowPriorityNode") + private Boolean allowLowPriorityNode; + + /** + * Get the ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. + * + * @param id the id value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withId(String id) { + this.id = id; + return this; + } + + /** + * Get it need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set it need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @param displayName the displayName value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @return the commandLine value + */ + public String commandLine() { + return this.commandLine; + } + + /** + * Set the command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @param commandLine the commandLine value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withCommandLine(String commandLine) { + this.commandLine = commandLine; + return this; + } + + /** + * Get if the pool that will run this task has containerConfiguration set, this must be set as well. If the pool that will run this task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @return the containerSettings value + */ + public TaskContainerSettings containerSettings() { + return this.containerSettings; + } + + /** + * Set if the pool that will run this task has containerConfiguration set, this must be set as well. If the pool that will run this task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @param containerSettings the containerSettings value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withContainerSettings(TaskContainerSettings containerSettings) { + this.containerSettings = containerSettings; + return this; + } + + /** + * Get files listed under this element are located in the task's working directory. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + * + * @return the resourceFiles value + */ + public List resourceFiles() { + return this.resourceFiles; + } + + /** + * Set files listed under this element are located in the task's working directory. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + * + * @param resourceFiles the resourceFiles value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withResourceFiles(List resourceFiles) { + this.resourceFiles = resourceFiles; + return this; + } + + /** + * Get for multi-instance tasks, the files will only be uploaded from the compute node on which the primary task is executed. + * + * @return the outputFiles value + */ + public List outputFiles() { + return this.outputFiles; + } + + /** + * Set for multi-instance tasks, the files will only be uploaded from the compute node on which the primary task is executed. + * + * @param outputFiles the outputFiles value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withOutputFiles(List outputFiles) { + this.outputFiles = outputFiles; + return this; + } + + /** + * Get the environmentSettings value. + * + * @return the environmentSettings value + */ + public List environmentSettings() { + return this.environmentSettings; + } + + /** + * Set the environmentSettings value. + * + * @param environmentSettings the environmentSettings value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withEnvironmentSettings(List environmentSettings) { + this.environmentSettings = environmentSettings; + return this; + } + + /** + * Get the constraints value. + * + * @return the constraints value + */ + public TaskConstraints constraints() { + return this.constraints; + } + + /** + * Set the constraints value. + * + * @param constraints the constraints value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withConstraints(TaskConstraints constraints) { + this.constraints = constraints; + return this; + } + + /** + * Get if true, when the Job Manager task completes, the Batch service marks the job as complete. If any tasks are still running at this time (other than Job Release), those tasks are terminated. If false, the completion of the Job Manager task does not affect the job status. In this case, you should either use the onAllTasksComplete attribute to terminate the job, or have a client or user terminate the job explicitly. An example of this is if the Job Manager creates a set of tasks but then takes no further role in their execution. The default value is true. If you are using the onAllTasksComplete and onTaskFailure attributes to control job lifetime, and using the Job Manager task only to create the tasks for the job (not to monitor progress), then it is important to set killJobOnCompletion to false. + * + * @return the killJobOnCompletion value + */ + public Boolean killJobOnCompletion() { + return this.killJobOnCompletion; + } + + /** + * Set if true, when the Job Manager task completes, the Batch service marks the job as complete. If any tasks are still running at this time (other than Job Release), those tasks are terminated. If false, the completion of the Job Manager task does not affect the job status. In this case, you should either use the onAllTasksComplete attribute to terminate the job, or have a client or user terminate the job explicitly. An example of this is if the Job Manager creates a set of tasks but then takes no further role in their execution. The default value is true. If you are using the onAllTasksComplete and onTaskFailure attributes to control job lifetime, and using the Job Manager task only to create the tasks for the job (not to monitor progress), then it is important to set killJobOnCompletion to false. + * + * @param killJobOnCompletion the killJobOnCompletion value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withKillJobOnCompletion(Boolean killJobOnCompletion) { + this.killJobOnCompletion = killJobOnCompletion; + return this; + } + + /** + * Get if omitted, the task runs as a non-administrative user unique to the task. + * + * @return the userIdentity value + */ + public UserIdentity userIdentity() { + return this.userIdentity; + } + + /** + * Set if omitted, the task runs as a non-administrative user unique to the task. + * + * @param userIdentity the userIdentity value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withUserIdentity(UserIdentity userIdentity) { + this.userIdentity = userIdentity; + return this; + } + + /** + * Get if true, no other tasks will run on the same compute node for as long as the Job Manager is running. If false, other tasks can run simultaneously with the Job Manager on a compute node. The Job Manager task counts normally against the node's concurrent task limit, so this is only relevant if the node allows multiple concurrent tasks. The default value is true. + * + * @return the runExclusive value + */ + public Boolean runExclusive() { + return this.runExclusive; + } + + /** + * Set if true, no other tasks will run on the same compute node for as long as the Job Manager is running. If false, other tasks can run simultaneously with the Job Manager on a compute node. The Job Manager task counts normally against the node's concurrent task limit, so this is only relevant if the node allows multiple concurrent tasks. The default value is true. + * + * @param runExclusive the runExclusive value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withRunExclusive(Boolean runExclusive) { + this.runExclusive = runExclusive; + return this; + } + + /** + * Get application packages are downloaded and deployed to a shared directory, not the task working directory. Therefore, if a referenced package is already on the compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application package cannot be installed, for example because the package has been deleted or because download failed, the task fails. + * + * @return the applicationPackageReferences value + */ + public List applicationPackageReferences() { + return this.applicationPackageReferences; + } + + /** + * Set application packages are downloaded and deployed to a shared directory, not the task working directory. Therefore, if a referenced package is already on the compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application package cannot be installed, for example because the package has been deleted or because download failed, the task fails. + * + * @param applicationPackageReferences the applicationPackageReferences value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withApplicationPackageReferences(List applicationPackageReferences) { + this.applicationPackageReferences = applicationPackageReferences; + return this; + } + + /** + * Get if this property is set, the Batch service provides the task with an authentication token which can be used to authenticate Batch service operations without requiring an account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the task can carry out using the token depend on the settings. For example, a task can request job permissions in order to add other tasks to the job, or check the status of the job or of other tasks under the job. + * + * @return the authenticationTokenSettings value + */ + public AuthenticationTokenSettings authenticationTokenSettings() { + return this.authenticationTokenSettings; + } + + /** + * Set if this property is set, the Batch service provides the task with an authentication token which can be used to authenticate Batch service operations without requiring an account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the task can carry out using the token depend on the settings. For example, a task can request job permissions in order to add other tasks to the job, or check the status of the job or of other tasks under the job. + * + * @param authenticationTokenSettings the authenticationTokenSettings value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withAuthenticationTokenSettings(AuthenticationTokenSettings authenticationTokenSettings) { + this.authenticationTokenSettings = authenticationTokenSettings; + return this; + } + + /** + * Get the default value is true. + * + * @return the allowLowPriorityNode value + */ + public Boolean allowLowPriorityNode() { + return this.allowLowPriorityNode; + } + + /** + * Set the default value is true. + * + * @param allowLowPriorityNode the allowLowPriorityNode value to set + * @return the JobManagerTask object itself. + */ + public JobManagerTask withAllowLowPriorityNode(Boolean allowLowPriorityNode) { + this.allowLowPriorityNode = allowLowPriorityNode; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobNetworkConfiguration.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobNetworkConfiguration.java new file mode 100644 index 000000000000..d046b080feec --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobNetworkConfiguration.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The network configuration for the job. + */ +public class JobNetworkConfiguration { + /** + * The ARM resource identifier of the virtual network subnet which nodes + * running tasks from the job will join for the duration of the task. + * This is only supported for jobs running on VirtualMachineConfiguration + * pools. This is of the form + * /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}. + * The virtual network must be in the same region and subscription as the + * Azure Batch account. The specified subnet should have enough free IP + * addresses to accommodate the number of nodes which will run tasks from + * the job. For more details, see + * https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + */ + @JsonProperty(value = "subnetId", required = true) + private String subnetId; + + /** + * Get this is only supported for jobs running on VirtualMachineConfiguration pools. This is of the form /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}. The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes which will run tasks from the job. For more details, see https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set this is only supported for jobs running on VirtualMachineConfiguration pools. This is of the form /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}. The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes which will run tasks from the job. For more details, see https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + * + * @param subnetId the subnetId value to set + * @return the JobNetworkConfiguration object itself. + */ + public JobNetworkConfiguration withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPatchHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPatchHeaders.java new file mode 100644 index 000000000000..12704df7e7f9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPatchHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Patch operation. + */ +public class JobPatchHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobPatchHeaders object itself. + */ + public JobPatchHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobPatchHeaders object itself. + */ + public JobPatchHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobPatchHeaders object itself. + */ + public JobPatchHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobPatchHeaders object itself. + */ + public JobPatchHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobPatchHeaders object itself. + */ + public JobPatchHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPatchOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPatchOptions.java new file mode 100644 index 000000000000..23e1a0a40e1d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPatchOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for patch operation. + */ +public class JobPatchOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobPatchOptions object itself. + */ + public JobPatchOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobPatchOptions object itself. + */ + public JobPatchOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobPatchOptions object itself. + */ + public JobPatchOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobPatchOptions object itself. + */ + public JobPatchOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobPatchOptions object itself. + */ + public JobPatchOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobPatchOptions object itself. + */ + public JobPatchOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobPatchOptions object itself. + */ + public JobPatchOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobPatchOptions object itself. + */ + public JobPatchOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPatchParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPatchParameter.java new file mode 100644 index 000000000000..6b8912703f92 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPatchParameter.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of changes to be made to a job. + */ +public class JobPatchParameter { + /** + * The priority of the job. + * Priority values can range from -1000 to 1000, with -1000 being the + * lowest priority and 1000 being the highest priority. If omitted, the + * priority of the job is left unchanged. + */ + @JsonProperty(value = "priority") + private Integer priority; + + /** + * The action the Batch service should take when all tasks in the job are + * in the completed state. + * If omitted, the completion behavior is left unchanged. You may not + * change the value from terminatejob to noaction - that is, once you have + * engaged automatic job termination, you cannot turn it off again. If you + * try to do this, the request fails with an 'invalid property value' error + * response; if you are calling the REST API directly, the HTTP status code + * is 400 (Bad Request). Possible values include: 'noAction', + * 'terminateJob'. + */ + @JsonProperty(value = "onAllTasksComplete") + private OnAllTasksComplete onAllTasksComplete; + + /** + * The execution constraints for the job. + * If omitted, the existing execution constraints are left unchanged. + */ + @JsonProperty(value = "constraints") + private JobConstraints constraints; + + /** + * The pool on which the Batch service runs the job's tasks. + * You may change the pool for a job only when the job is disabled. The + * Patch Job call will fail if you include the poolInfo element and the job + * is not disabled. If you specify an autoPoolSpecification specification + * in the poolInfo, only the keepAlive property can be updated, and then + * only if the auto pool has a poolLifetimeOption of job. If omitted, the + * job continues to run on its current pool. + */ + @JsonProperty(value = "poolInfo") + private PoolInformation poolInfo; + + /** + * A list of name-value pairs associated with the job as metadata. + * If omitted, the existing job metadata is left unchanged. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Get priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If omitted, the priority of the job is left unchanged. + * + * @return the priority value + */ + public Integer priority() { + return this.priority; + } + + /** + * Set priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If omitted, the priority of the job is left unchanged. + * + * @param priority the priority value to set + * @return the JobPatchParameter object itself. + */ + public JobPatchParameter withPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get if omitted, the completion behavior is left unchanged. You may not change the value from terminatejob to noaction - that is, once you have engaged automatic job termination, you cannot turn it off again. If you try to do this, the request fails with an 'invalid property value' error response; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). Possible values include: 'noAction', 'terminateJob'. + * + * @return the onAllTasksComplete value + */ + public OnAllTasksComplete onAllTasksComplete() { + return this.onAllTasksComplete; + } + + /** + * Set if omitted, the completion behavior is left unchanged. You may not change the value from terminatejob to noaction - that is, once you have engaged automatic job termination, you cannot turn it off again. If you try to do this, the request fails with an 'invalid property value' error response; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). Possible values include: 'noAction', 'terminateJob'. + * + * @param onAllTasksComplete the onAllTasksComplete value to set + * @return the JobPatchParameter object itself. + */ + public JobPatchParameter withOnAllTasksComplete(OnAllTasksComplete onAllTasksComplete) { + this.onAllTasksComplete = onAllTasksComplete; + return this; + } + + /** + * Get if omitted, the existing execution constraints are left unchanged. + * + * @return the constraints value + */ + public JobConstraints constraints() { + return this.constraints; + } + + /** + * Set if omitted, the existing execution constraints are left unchanged. + * + * @param constraints the constraints value to set + * @return the JobPatchParameter object itself. + */ + public JobPatchParameter withConstraints(JobConstraints constraints) { + this.constraints = constraints; + return this; + } + + /** + * Get you may change the pool for a job only when the job is disabled. The Patch Job call will fail if you include the poolInfo element and the job is not disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. If omitted, the job continues to run on its current pool. + * + * @return the poolInfo value + */ + public PoolInformation poolInfo() { + return this.poolInfo; + } + + /** + * Set you may change the pool for a job only when the job is disabled. The Patch Job call will fail if you include the poolInfo element and the job is not disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. If omitted, the job continues to run on its current pool. + * + * @param poolInfo the poolInfo value to set + * @return the JobPatchParameter object itself. + */ + public JobPatchParameter withPoolInfo(PoolInformation poolInfo) { + this.poolInfo = poolInfo; + return this; + } + + /** + * Get if omitted, the existing job metadata is left unchanged. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set if omitted, the existing job metadata is left unchanged. + * + * @param metadata the metadata value to set + * @return the JobPatchParameter object itself. + */ + public JobPatchParameter withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationAndReleaseTaskExecutionInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationAndReleaseTaskExecutionInformation.java new file mode 100644 index 000000000000..97125d337c33 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationAndReleaseTaskExecutionInformation.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The status of the Job Preparation and Job Release tasks on a compute node. + */ +public class JobPreparationAndReleaseTaskExecutionInformation { + /** + * The ID of the pool containing the compute node to which this entry + * refers. + */ + @JsonProperty(value = "poolId") + private String poolId; + + /** + * The ID of the compute node to which this entry refers. + */ + @JsonProperty(value = "nodeId") + private String nodeId; + + /** + * The URL of the compute node to which this entry refers. + */ + @JsonProperty(value = "nodeUrl") + private String nodeUrl; + + /** + * Information about the execution status of the Job Preparation task on + * this compute node. + */ + @JsonProperty(value = "jobPreparationTaskExecutionInfo") + private JobPreparationTaskExecutionInformation jobPreparationTaskExecutionInfo; + + /** + * Information about the execution status of the Job Release task on this + * compute node. + * This property is set only if the Job Release task has run on the node. + */ + @JsonProperty(value = "jobReleaseTaskExecutionInfo") + private JobReleaseTaskExecutionInformation jobReleaseTaskExecutionInfo; + + /** + * Get the poolId value. + * + * @return the poolId value + */ + public String poolId() { + return this.poolId; + } + + /** + * Set the poolId value. + * + * @param poolId the poolId value to set + * @return the JobPreparationAndReleaseTaskExecutionInformation object itself. + */ + public JobPreparationAndReleaseTaskExecutionInformation withPoolId(String poolId) { + this.poolId = poolId; + return this; + } + + /** + * Get the nodeId value. + * + * @return the nodeId value + */ + public String nodeId() { + return this.nodeId; + } + + /** + * Set the nodeId value. + * + * @param nodeId the nodeId value to set + * @return the JobPreparationAndReleaseTaskExecutionInformation object itself. + */ + public JobPreparationAndReleaseTaskExecutionInformation withNodeId(String nodeId) { + this.nodeId = nodeId; + return this; + } + + /** + * Get the nodeUrl value. + * + * @return the nodeUrl value + */ + public String nodeUrl() { + return this.nodeUrl; + } + + /** + * Set the nodeUrl value. + * + * @param nodeUrl the nodeUrl value to set + * @return the JobPreparationAndReleaseTaskExecutionInformation object itself. + */ + public JobPreparationAndReleaseTaskExecutionInformation withNodeUrl(String nodeUrl) { + this.nodeUrl = nodeUrl; + return this; + } + + /** + * Get the jobPreparationTaskExecutionInfo value. + * + * @return the jobPreparationTaskExecutionInfo value + */ + public JobPreparationTaskExecutionInformation jobPreparationTaskExecutionInfo() { + return this.jobPreparationTaskExecutionInfo; + } + + /** + * Set the jobPreparationTaskExecutionInfo value. + * + * @param jobPreparationTaskExecutionInfo the jobPreparationTaskExecutionInfo value to set + * @return the JobPreparationAndReleaseTaskExecutionInformation object itself. + */ + public JobPreparationAndReleaseTaskExecutionInformation withJobPreparationTaskExecutionInfo(JobPreparationTaskExecutionInformation jobPreparationTaskExecutionInfo) { + this.jobPreparationTaskExecutionInfo = jobPreparationTaskExecutionInfo; + return this; + } + + /** + * Get this property is set only if the Job Release task has run on the node. + * + * @return the jobReleaseTaskExecutionInfo value + */ + public JobReleaseTaskExecutionInformation jobReleaseTaskExecutionInfo() { + return this.jobReleaseTaskExecutionInfo; + } + + /** + * Set this property is set only if the Job Release task has run on the node. + * + * @param jobReleaseTaskExecutionInfo the jobReleaseTaskExecutionInfo value to set + * @return the JobPreparationAndReleaseTaskExecutionInformation object itself. + */ + public JobPreparationAndReleaseTaskExecutionInformation withJobReleaseTaskExecutionInfo(JobReleaseTaskExecutionInformation jobReleaseTaskExecutionInfo) { + this.jobReleaseTaskExecutionInfo = jobReleaseTaskExecutionInfo; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationTask.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationTask.java new file mode 100644 index 000000000000..510f55884be5 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationTask.java @@ -0,0 +1,329 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Job Preparation task to run before any tasks of the job on any given + * compute node. + * You can use Job Preparation to prepare a compute node to run tasks for the + * job. Activities commonly performed in Job Preparation include: Downloading + * common resource files used by all the tasks in the job. The Job Preparation + * task can download these common resource files to the shared location on the + * compute node. (AZ_BATCH_NODE_ROOT_DIR\shared), or starting a local service + * on the compute node so that all tasks of that job can communicate with it. + * If the Job Preparation task fails (that is, exhausts its retry count before + * exiting with exit code 0), Batch will not run tasks of this job on the + * compute node. The node remains ineligible to run tasks of this job until it + * is reimaged. The node remains active and can be used for other jobs. The Job + * Preparation task can run multiple times on the same compute node. Therefore, + * you should write the Job Preparation task to handle re-execution. If the + * compute node is rebooted, the Job Preparation task is run again on the node + * before scheduling any other task of the job, if + * rerunOnNodeRebootAfterSuccess is true or if the Job Preparation task did not + * previously complete. If the compute node is reimaged, the Job Preparation + * task is run again before scheduling any task of the job. Batch will retry + * tasks when a recovery operation is triggered on a compute node. Examples of + * recovery operations include (but are not limited to) when an unhealthy + * compute node is rebooted or a compute node disappeared due to host failure. + * Retries due to recovery operations are independent of and are not counted + * against the maxTaskRetryCount. Even if the maxTaskRetryCount is 0, an + * internal retry due to a recovery operation may occur. Because of this, all + * tasks should be idempotent. This means tasks need to tolerate being + * interrupted and restarted without causing any corruption or duplicate data. + * The best practice for long running tasks is to use some form of + * checkpointing. + */ +public class JobPreparationTask { + /** + * A string that uniquely identifies the Job Preparation task within the + * job. + * The ID can contain any combination of alphanumeric characters including + * hyphens and underscores and cannot contain more than 64 characters. If + * you do not specify this property, the Batch service assigns a default + * value of 'jobpreparation'. No other task in the job can have the same ID + * as the Job Preparation task. If you try to submit a task with the same + * id, the Batch service rejects the request with error code + * TaskIdSameAsJobPreparationTask; if you are calling the REST API + * directly, the HTTP status code is 409 (Conflict). + */ + @JsonProperty(value = "id") + private String id; + + /** + * The command line of the Job Preparation task. + * The command line does not run under a shell, and therefore cannot take + * advantage of shell features such as environment variable expansion. If + * you want to take advantage of such features, you should invoke the shell + * in the command line, for example using "cmd /c MyCommand" in Windows or + * "/bin/sh -c MyCommand" in Linux. If the command line refers to file + * paths, it should use a relative path (relative to the task working + * directory), or use the Batch provided environment variable + * (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + */ + @JsonProperty(value = "commandLine", required = true) + private String commandLine; + + /** + * The settings for the container under which the Job Preparation task + * runs. + * When this is specified, all directories recursively below the + * AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) + * are mapped into the container, all task environment variables are mapped + * into the container, and the task command line is executed in the + * container. + */ + @JsonProperty(value = "containerSettings") + private TaskContainerSettings containerSettings; + + /** + * A list of files that the Batch service will download to the compute node + * before running the command line. + * Files listed under this element are located in the task's working + * directory. There is a maximum size for the list of resource files. + * When the max size is exceeded, the request will fail and the response + * error code will be RequestEntityTooLarge. If this occurs, the collection + * of ResourceFiles must be reduced in size. This can be achieved using + * .zip files, Application Packages, or Docker Containers. + */ + @JsonProperty(value = "resourceFiles") + private List resourceFiles; + + /** + * A list of environment variable settings for the Job Preparation task. + */ + @JsonProperty(value = "environmentSettings") + private List environmentSettings; + + /** + * Constraints that apply to the Job Preparation task. + */ + @JsonProperty(value = "constraints") + private TaskConstraints constraints; + + /** + * Whether the Batch service should wait for the Job Preparation task to + * complete successfully before scheduling any other tasks of the job on + * the compute node. A Job Preparation task has completed successfully if + * it exits with exit code 0. + * If true and the Job Preparation task fails on a compute node, the Batch + * service retries the Job Preparation task up to its maximum retry count + * (as specified in the constraints element). If the task has still not + * completed successfully after all retries, then the Batch service will + * not schedule tasks of the job to the compute node. The compute node + * remains active and eligible to run tasks of other jobs. If false, the + * Batch service will not wait for the Job Preparation task to complete. In + * this case, other tasks of the job can start executing on the compute + * node while the Job Preparation task is still running; and even if the + * Job Preparation task fails, new tasks will continue to be scheduled on + * the node. The default value is true. + */ + @JsonProperty(value = "waitForSuccess") + private Boolean waitForSuccess; + + /** + * The user identity under which the Job Preparation task runs. + * If omitted, the task runs as a non-administrative user unique to the + * task on Windows nodes, or a non-administrative user unique to the pool + * on Linux nodes. + */ + @JsonProperty(value = "userIdentity") + private UserIdentity userIdentity; + + /** + * Whether the Batch service should rerun the Job Preparation task after a + * compute node reboots. + * The Job Preparation task is always rerun if a compute node is reimaged, + * or if the Job Preparation task did not complete (e.g. because the reboot + * occurred while the task was running). Therefore, you should always write + * a Job Preparation task to be idempotent and to behave correctly if run + * multiple times. The default value is true. + */ + @JsonProperty(value = "rerunOnNodeRebootAfterSuccess") + private Boolean rerunOnNodeRebootAfterSuccess; + + /** + * Get the ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. If you do not specify this property, the Batch service assigns a default value of 'jobpreparation'. No other task in the job can have the same ID as the Job Preparation task. If you try to submit a task with the same id, the Batch service rejects the request with error code TaskIdSameAsJobPreparationTask; if you are calling the REST API directly, the HTTP status code is 409 (Conflict). + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. If you do not specify this property, the Batch service assigns a default value of 'jobpreparation'. No other task in the job can have the same ID as the Job Preparation task. If you try to submit a task with the same id, the Batch service rejects the request with error code TaskIdSameAsJobPreparationTask; if you are calling the REST API directly, the HTTP status code is 409 (Conflict). + * + * @param id the id value to set + * @return the JobPreparationTask object itself. + */ + public JobPreparationTask withId(String id) { + this.id = id; + return this; + } + + /** + * Get the command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @return the commandLine value + */ + public String commandLine() { + return this.commandLine; + } + + /** + * Set the command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @param commandLine the commandLine value to set + * @return the JobPreparationTask object itself. + */ + public JobPreparationTask withCommandLine(String commandLine) { + this.commandLine = commandLine; + return this; + } + + /** + * Get when this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @return the containerSettings value + */ + public TaskContainerSettings containerSettings() { + return this.containerSettings; + } + + /** + * Set when this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @param containerSettings the containerSettings value to set + * @return the JobPreparationTask object itself. + */ + public JobPreparationTask withContainerSettings(TaskContainerSettings containerSettings) { + this.containerSettings = containerSettings; + return this; + } + + /** + * Get files listed under this element are located in the task's working directory. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + * + * @return the resourceFiles value + */ + public List resourceFiles() { + return this.resourceFiles; + } + + /** + * Set files listed under this element are located in the task's working directory. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + * + * @param resourceFiles the resourceFiles value to set + * @return the JobPreparationTask object itself. + */ + public JobPreparationTask withResourceFiles(List resourceFiles) { + this.resourceFiles = resourceFiles; + return this; + } + + /** + * Get the environmentSettings value. + * + * @return the environmentSettings value + */ + public List environmentSettings() { + return this.environmentSettings; + } + + /** + * Set the environmentSettings value. + * + * @param environmentSettings the environmentSettings value to set + * @return the JobPreparationTask object itself. + */ + public JobPreparationTask withEnvironmentSettings(List environmentSettings) { + this.environmentSettings = environmentSettings; + return this; + } + + /** + * Get the constraints value. + * + * @return the constraints value + */ + public TaskConstraints constraints() { + return this.constraints; + } + + /** + * Set the constraints value. + * + * @param constraints the constraints value to set + * @return the JobPreparationTask object itself. + */ + public JobPreparationTask withConstraints(TaskConstraints constraints) { + this.constraints = constraints; + return this; + } + + /** + * Get if true and the Job Preparation task fails on a compute node, the Batch service retries the Job Preparation task up to its maximum retry count (as specified in the constraints element). If the task has still not completed successfully after all retries, then the Batch service will not schedule tasks of the job to the compute node. The compute node remains active and eligible to run tasks of other jobs. If false, the Batch service will not wait for the Job Preparation task to complete. In this case, other tasks of the job can start executing on the compute node while the Job Preparation task is still running; and even if the Job Preparation task fails, new tasks will continue to be scheduled on the node. The default value is true. + * + * @return the waitForSuccess value + */ + public Boolean waitForSuccess() { + return this.waitForSuccess; + } + + /** + * Set if true and the Job Preparation task fails on a compute node, the Batch service retries the Job Preparation task up to its maximum retry count (as specified in the constraints element). If the task has still not completed successfully after all retries, then the Batch service will not schedule tasks of the job to the compute node. The compute node remains active and eligible to run tasks of other jobs. If false, the Batch service will not wait for the Job Preparation task to complete. In this case, other tasks of the job can start executing on the compute node while the Job Preparation task is still running; and even if the Job Preparation task fails, new tasks will continue to be scheduled on the node. The default value is true. + * + * @param waitForSuccess the waitForSuccess value to set + * @return the JobPreparationTask object itself. + */ + public JobPreparationTask withWaitForSuccess(Boolean waitForSuccess) { + this.waitForSuccess = waitForSuccess; + return this; + } + + /** + * Get if omitted, the task runs as a non-administrative user unique to the task on Windows nodes, or a non-administrative user unique to the pool on Linux nodes. + * + * @return the userIdentity value + */ + public UserIdentity userIdentity() { + return this.userIdentity; + } + + /** + * Set if omitted, the task runs as a non-administrative user unique to the task on Windows nodes, or a non-administrative user unique to the pool on Linux nodes. + * + * @param userIdentity the userIdentity value to set + * @return the JobPreparationTask object itself. + */ + public JobPreparationTask withUserIdentity(UserIdentity userIdentity) { + this.userIdentity = userIdentity; + return this; + } + + /** + * Get the Job Preparation task is always rerun if a compute node is reimaged, or if the Job Preparation task did not complete (e.g. because the reboot occurred while the task was running). Therefore, you should always write a Job Preparation task to be idempotent and to behave correctly if run multiple times. The default value is true. + * + * @return the rerunOnNodeRebootAfterSuccess value + */ + public Boolean rerunOnNodeRebootAfterSuccess() { + return this.rerunOnNodeRebootAfterSuccess; + } + + /** + * Set the Job Preparation task is always rerun if a compute node is reimaged, or if the Job Preparation task did not complete (e.g. because the reboot occurred while the task was running). Therefore, you should always write a Job Preparation task to be idempotent and to behave correctly if run multiple times. The default value is true. + * + * @param rerunOnNodeRebootAfterSuccess the rerunOnNodeRebootAfterSuccess value to set + * @return the JobPreparationTask object itself. + */ + public JobPreparationTask withRerunOnNodeRebootAfterSuccess(Boolean rerunOnNodeRebootAfterSuccess) { + this.rerunOnNodeRebootAfterSuccess = rerunOnNodeRebootAfterSuccess; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationTaskExecutionInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationTaskExecutionInformation.java new file mode 100644 index 000000000000..bb18da0a2c7a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationTaskExecutionInformation.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about the execution of a Job Preparation task on a + * compute node. + */ +public class JobPreparationTaskExecutionInformation { + /** + * The time at which the task started running. + * If the task has been restarted or retried, this is the most recent time + * at which the task started running. + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The time at which the Job Preparation task completed. + * This property is set only if the task is in the Completed state. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * The current state of the Job Preparation task on the compute node. + * Possible values include: 'running', 'completed'. + */ + @JsonProperty(value = "state", required = true) + private JobPreparationTaskState state; + + /** + * The root directory of the Job Preparation task on the compute node. You + * can use this path to retrieve files created by the task, such as log + * files. + */ + @JsonProperty(value = "taskRootDirectory") + private String taskRootDirectory; + + /** + * The URL to the root directory of the Job Preparation task on the compute + * node. + */ + @JsonProperty(value = "taskRootDirectoryUrl") + private String taskRootDirectoryUrl; + + /** + * The exit code of the program specified on the task command line. + * This parameter is returned only if the task is in the completed state. + * The exit code for a process reflects the specific convention implemented + * by the application developer for that process. If you use the exit code + * value to make decisions in your code, be sure that you know the exit + * code convention used by the application process. Note that the exit code + * may also be generated by the compute node operating system, such as when + * a process is forcibly terminated. + */ + @JsonProperty(value = "exitCode") + private Integer exitCode; + + /** + * Information about the container under which the task is executing. + * This property is set only if the task runs in a container context. + */ + @JsonProperty(value = "containerInfo") + private TaskContainerExecutionInformation containerInfo; + + /** + * Information describing the task failure, if any. + * This property is set only if the task is in the completed state and + * encountered a failure. + */ + @JsonProperty(value = "failureInfo") + private TaskFailureInformation failureInfo; + + /** + * The number of times the task has been retried by the Batch service. Task + * application failures (non-zero exit code) are retried, pre-processing + * errors (the task could not be run) and file upload errors are not + * retried. The Batch service will retry the task up to the limit specified + * by the constraints. + * Task application failures (non-zero exit code) are retried, + * pre-processing errors (the task could not be run) and file upload errors + * are not retried. The Batch service will retry the task up to the limit + * specified by the constraints. + */ + @JsonProperty(value = "retryCount", required = true) + private int retryCount; + + /** + * The most recent time at which a retry of the Job Preparation task + * started running. + * This property is set only if the task was retried (i.e. retryCount is + * nonzero). If present, this is typically the same as startTime, but may + * be different if the task has been restarted for reasons other than + * retry; for example, if the compute node was rebooted during a retry, + * then the startTime is updated but the lastRetryTime is not. + */ + @JsonProperty(value = "lastRetryTime") + private DateTime lastRetryTime; + + /** + * The result of the task execution. + * If the value is 'failed', then the details of the failure can be found + * in the failureInfo property. Possible values include: 'success', + * 'failure'. + */ + @JsonProperty(value = "result") + private TaskExecutionResult result; + + /** + * Get if the task has been restarted or retried, this is the most recent time at which the task started running. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set if the task has been restarted or retried, this is the most recent time at which the task started running. + * + * @param startTime the startTime value to set + * @return the JobPreparationTaskExecutionInformation object itself. + */ + public JobPreparationTaskExecutionInformation withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get this property is set only if the task is in the Completed state. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set this property is set only if the task is in the Completed state. + * + * @param endTime the endTime value to set + * @return the JobPreparationTaskExecutionInformation object itself. + */ + public JobPreparationTaskExecutionInformation withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get possible values include: 'running', 'completed'. + * + * @return the state value + */ + public JobPreparationTaskState state() { + return this.state; + } + + /** + * Set possible values include: 'running', 'completed'. + * + * @param state the state value to set + * @return the JobPreparationTaskExecutionInformation object itself. + */ + public JobPreparationTaskExecutionInformation withState(JobPreparationTaskState state) { + this.state = state; + return this; + } + + /** + * Get the taskRootDirectory value. + * + * @return the taskRootDirectory value + */ + public String taskRootDirectory() { + return this.taskRootDirectory; + } + + /** + * Set the taskRootDirectory value. + * + * @param taskRootDirectory the taskRootDirectory value to set + * @return the JobPreparationTaskExecutionInformation object itself. + */ + public JobPreparationTaskExecutionInformation withTaskRootDirectory(String taskRootDirectory) { + this.taskRootDirectory = taskRootDirectory; + return this; + } + + /** + * Get the taskRootDirectoryUrl value. + * + * @return the taskRootDirectoryUrl value + */ + public String taskRootDirectoryUrl() { + return this.taskRootDirectoryUrl; + } + + /** + * Set the taskRootDirectoryUrl value. + * + * @param taskRootDirectoryUrl the taskRootDirectoryUrl value to set + * @return the JobPreparationTaskExecutionInformation object itself. + */ + public JobPreparationTaskExecutionInformation withTaskRootDirectoryUrl(String taskRootDirectoryUrl) { + this.taskRootDirectoryUrl = taskRootDirectoryUrl; + return this; + } + + /** + * Get this parameter is returned only if the task is in the completed state. The exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. Note that the exit code may also be generated by the compute node operating system, such as when a process is forcibly terminated. + * + * @return the exitCode value + */ + public Integer exitCode() { + return this.exitCode; + } + + /** + * Set this parameter is returned only if the task is in the completed state. The exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. Note that the exit code may also be generated by the compute node operating system, such as when a process is forcibly terminated. + * + * @param exitCode the exitCode value to set + * @return the JobPreparationTaskExecutionInformation object itself. + */ + public JobPreparationTaskExecutionInformation withExitCode(Integer exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get this property is set only if the task runs in a container context. + * + * @return the containerInfo value + */ + public TaskContainerExecutionInformation containerInfo() { + return this.containerInfo; + } + + /** + * Set this property is set only if the task runs in a container context. + * + * @param containerInfo the containerInfo value to set + * @return the JobPreparationTaskExecutionInformation object itself. + */ + public JobPreparationTaskExecutionInformation withContainerInfo(TaskContainerExecutionInformation containerInfo) { + this.containerInfo = containerInfo; + return this; + } + + /** + * Get this property is set only if the task is in the completed state and encountered a failure. + * + * @return the failureInfo value + */ + public TaskFailureInformation failureInfo() { + return this.failureInfo; + } + + /** + * Set this property is set only if the task is in the completed state and encountered a failure. + * + * @param failureInfo the failureInfo value to set + * @return the JobPreparationTaskExecutionInformation object itself. + */ + public JobPreparationTaskExecutionInformation withFailureInfo(TaskFailureInformation failureInfo) { + this.failureInfo = failureInfo; + return this; + } + + /** + * Get task application failures (non-zero exit code) are retried, pre-processing errors (the task could not be run) and file upload errors are not retried. The Batch service will retry the task up to the limit specified by the constraints. + * + * @return the retryCount value + */ + public int retryCount() { + return this.retryCount; + } + + /** + * Set task application failures (non-zero exit code) are retried, pre-processing errors (the task could not be run) and file upload errors are not retried. The Batch service will retry the task up to the limit specified by the constraints. + * + * @param retryCount the retryCount value to set + * @return the JobPreparationTaskExecutionInformation object itself. + */ + public JobPreparationTaskExecutionInformation withRetryCount(int retryCount) { + this.retryCount = retryCount; + return this; + } + + /** + * Get this property is set only if the task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the task has been restarted for reasons other than retry; for example, if the compute node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not. + * + * @return the lastRetryTime value + */ + public DateTime lastRetryTime() { + return this.lastRetryTime; + } + + /** + * Set this property is set only if the task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the task has been restarted for reasons other than retry; for example, if the compute node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not. + * + * @param lastRetryTime the lastRetryTime value to set + * @return the JobPreparationTaskExecutionInformation object itself. + */ + public JobPreparationTaskExecutionInformation withLastRetryTime(DateTime lastRetryTime) { + this.lastRetryTime = lastRetryTime; + return this; + } + + /** + * Get if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'. + * + * @return the result value + */ + public TaskExecutionResult result() { + return this.result; + } + + /** + * Set if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'. + * + * @param result the result value to set + * @return the JobPreparationTaskExecutionInformation object itself. + */ + public JobPreparationTaskExecutionInformation withResult(TaskExecutionResult result) { + this.result = result; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationTaskState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationTaskState.java new file mode 100644 index 000000000000..d157cb322701 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobPreparationTaskState.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobPreparationTaskState. + */ +public enum JobPreparationTaskState { + /** The task is currently running (including retrying). */ + RUNNING("running"), + + /** The task has exited with exit code 0, or the task has exhausted its retry limit, or the Batch service was unable to start the task due to task preparation errors (such as resource file download failures). */ + COMPLETED("completed"); + + /** The actual serialized value for a JobPreparationTaskState instance. */ + private String value; + + JobPreparationTaskState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobPreparationTaskState instance. + * + * @param value the serialized value to parse. + * @return the parsed JobPreparationTaskState object, or null if unable to parse. + */ + @JsonCreator + public static JobPreparationTaskState fromString(String value) { + JobPreparationTaskState[] items = JobPreparationTaskState.values(); + for (JobPreparationTaskState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobReleaseTask.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobReleaseTask.java new file mode 100644 index 000000000000..d63205a7b86c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobReleaseTask.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Job Release task to run on job completion on any compute node where the + * job has run. + * The Job Release task runs when the job ends, because of one of the + * following: The user calls the Terminate Job API, or the Delete Job API while + * the job is still active, the job's maximum wall clock time constraint is + * reached, and the job is still active, or the job's Job Manager task + * completed, and the job is configured to terminate when the Job Manager + * completes. The Job Release task runs on each compute node where tasks of the + * job have run and the Job Preparation task ran and completed. If you reimage + * a compute node after it has run the Job Preparation task, and the job ends + * without any further tasks of the job running on that compute node (and hence + * the Job Preparation task does not re-run), then the Job Release task does + * not run on that node. If a compute node reboots while the Job Release task + * is still running, the Job Release task runs again when the compute node + * starts up. The job is not marked as complete until all Job Release tasks + * have completed. The Job Release task runs in the background. It does not + * occupy a scheduling slot; that is, it does not count towards the + * maxTasksPerNode limit specified on the pool. + */ +public class JobReleaseTask { + /** + * A string that uniquely identifies the Job Release task within the job. + * The ID can contain any combination of alphanumeric characters including + * hyphens and underscores and cannot contain more than 64 characters. If + * you do not specify this property, the Batch service assigns a default + * value of 'jobrelease'. No other task in the job can have the same ID as + * the Job Release task. If you try to submit a task with the same id, the + * Batch service rejects the request with error code + * TaskIdSameAsJobReleaseTask; if you are calling the REST API directly, + * the HTTP status code is 409 (Conflict). + */ + @JsonProperty(value = "id") + private String id; + + /** + * The command line of the Job Release task. + * The command line does not run under a shell, and therefore cannot take + * advantage of shell features such as environment variable expansion. If + * you want to take advantage of such features, you should invoke the shell + * in the command line, for example using "cmd /c MyCommand" in Windows or + * "/bin/sh -c MyCommand" in Linux. If the command line refers to file + * paths, it should use a relative path (relative to the task working + * directory), or use the Batch provided environment variable + * (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + */ + @JsonProperty(value = "commandLine", required = true) + private String commandLine; + + /** + * The settings for the container under which the Job Release task runs. + * When this is specified, all directories recursively below the + * AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) + * are mapped into the container, all task environment variables are mapped + * into the container, and the task command line is executed in the + * container. + */ + @JsonProperty(value = "containerSettings") + private TaskContainerSettings containerSettings; + + /** + * A list of files that the Batch service will download to the compute node + * before running the command line. There is a maximum size for the list + * of resource files. When the max size is exceeded, the request will fail + * and the response error code will be RequestEntityTooLarge. If this + * occurs, the collection of ResourceFiles must be reduced in size. This + * can be achieved using .zip files, Application Packages, or Docker + * Containers. + * Files listed under this element are located in the task's working + * directory. + */ + @JsonProperty(value = "resourceFiles") + private List resourceFiles; + + /** + * A list of environment variable settings for the Job Release task. + */ + @JsonProperty(value = "environmentSettings") + private List environmentSettings; + + /** + * The maximum elapsed time that the Job Release task may run on a given + * compute node, measured from the time the task starts. If the task does + * not complete within the time limit, the Batch service terminates it. The + * default value is 15 minutes. You may not specify a timeout longer than + * 15 minutes. If you do, the Batch service rejects it with an error; if + * you are calling the REST API directly, the HTTP status code is 400 (Bad + * Request). + */ + @JsonProperty(value = "maxWallClockTime") + private Period maxWallClockTime; + + /** + * The minimum time to retain the task directory for the Job Release task + * on the compute node. After this time, the Batch service may delete the + * task directory and all its contents. + * The default is 7 days, i.e. the task directory will be retained for 7 + * days unless the compute node is removed or the job is deleted. + */ + @JsonProperty(value = "retentionTime") + private Period retentionTime; + + /** + * The user identity under which the Job Release task runs. + * If omitted, the task runs as a non-administrative user unique to the + * task. + */ + @JsonProperty(value = "userIdentity") + private UserIdentity userIdentity; + + /** + * Get the ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. If you do not specify this property, the Batch service assigns a default value of 'jobrelease'. No other task in the job can have the same ID as the Job Release task. If you try to submit a task with the same id, the Batch service rejects the request with error code TaskIdSameAsJobReleaseTask; if you are calling the REST API directly, the HTTP status code is 409 (Conflict). + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. If you do not specify this property, the Batch service assigns a default value of 'jobrelease'. No other task in the job can have the same ID as the Job Release task. If you try to submit a task with the same id, the Batch service rejects the request with error code TaskIdSameAsJobReleaseTask; if you are calling the REST API directly, the HTTP status code is 409 (Conflict). + * + * @param id the id value to set + * @return the JobReleaseTask object itself. + */ + public JobReleaseTask withId(String id) { + this.id = id; + return this; + } + + /** + * Get the command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @return the commandLine value + */ + public String commandLine() { + return this.commandLine; + } + + /** + * Set the command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @param commandLine the commandLine value to set + * @return the JobReleaseTask object itself. + */ + public JobReleaseTask withCommandLine(String commandLine) { + this.commandLine = commandLine; + return this; + } + + /** + * Get when this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @return the containerSettings value + */ + public TaskContainerSettings containerSettings() { + return this.containerSettings; + } + + /** + * Set when this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @param containerSettings the containerSettings value to set + * @return the JobReleaseTask object itself. + */ + public JobReleaseTask withContainerSettings(TaskContainerSettings containerSettings) { + this.containerSettings = containerSettings; + return this; + } + + /** + * Get files listed under this element are located in the task's working directory. + * + * @return the resourceFiles value + */ + public List resourceFiles() { + return this.resourceFiles; + } + + /** + * Set files listed under this element are located in the task's working directory. + * + * @param resourceFiles the resourceFiles value to set + * @return the JobReleaseTask object itself. + */ + public JobReleaseTask withResourceFiles(List resourceFiles) { + this.resourceFiles = resourceFiles; + return this; + } + + /** + * Get the environmentSettings value. + * + * @return the environmentSettings value + */ + public List environmentSettings() { + return this.environmentSettings; + } + + /** + * Set the environmentSettings value. + * + * @param environmentSettings the environmentSettings value to set + * @return the JobReleaseTask object itself. + */ + public JobReleaseTask withEnvironmentSettings(List environmentSettings) { + this.environmentSettings = environmentSettings; + return this; + } + + /** + * Get the maxWallClockTime value. + * + * @return the maxWallClockTime value + */ + public Period maxWallClockTime() { + return this.maxWallClockTime; + } + + /** + * Set the maxWallClockTime value. + * + * @param maxWallClockTime the maxWallClockTime value to set + * @return the JobReleaseTask object itself. + */ + public JobReleaseTask withMaxWallClockTime(Period maxWallClockTime) { + this.maxWallClockTime = maxWallClockTime; + return this; + } + + /** + * Get the default is 7 days, i.e. the task directory will be retained for 7 days unless the compute node is removed or the job is deleted. + * + * @return the retentionTime value + */ + public Period retentionTime() { + return this.retentionTime; + } + + /** + * Set the default is 7 days, i.e. the task directory will be retained for 7 days unless the compute node is removed or the job is deleted. + * + * @param retentionTime the retentionTime value to set + * @return the JobReleaseTask object itself. + */ + public JobReleaseTask withRetentionTime(Period retentionTime) { + this.retentionTime = retentionTime; + return this; + } + + /** + * Get if omitted, the task runs as a non-administrative user unique to the task. + * + * @return the userIdentity value + */ + public UserIdentity userIdentity() { + return this.userIdentity; + } + + /** + * Set if omitted, the task runs as a non-administrative user unique to the task. + * + * @param userIdentity the userIdentity value to set + * @return the JobReleaseTask object itself. + */ + public JobReleaseTask withUserIdentity(UserIdentity userIdentity) { + this.userIdentity = userIdentity; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobReleaseTaskExecutionInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobReleaseTaskExecutionInformation.java new file mode 100644 index 000000000000..2d5352691b10 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobReleaseTaskExecutionInformation.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about the execution of a Job Release task on a compute + * node. + */ +public class JobReleaseTaskExecutionInformation { + /** + * The time at which the task started running. + * If the task has been restarted or retried, this is the most recent time + * at which the task started running. + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The time at which the Job Release task completed. + * This property is set only if the task is in the Completed state. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * The current state of the Job Release task on the compute node. + * Possible values include: 'running', 'completed'. + */ + @JsonProperty(value = "state", required = true) + private JobReleaseTaskState state; + + /** + * The root directory of the Job Release task on the compute node. You can + * use this path to retrieve files created by the task, such as log files. + */ + @JsonProperty(value = "taskRootDirectory") + private String taskRootDirectory; + + /** + * The URL to the root directory of the Job Release task on the compute + * node. + */ + @JsonProperty(value = "taskRootDirectoryUrl") + private String taskRootDirectoryUrl; + + /** + * The exit code of the program specified on the task command line. + * This parameter is returned only if the task is in the completed state. + * The exit code for a process reflects the specific convention implemented + * by the application developer for that process. If you use the exit code + * value to make decisions in your code, be sure that you know the exit + * code convention used by the application process. Note that the exit code + * may also be generated by the compute node operating system, such as when + * a process is forcibly terminated. + */ + @JsonProperty(value = "exitCode") + private Integer exitCode; + + /** + * Information about the container under which the task is executing. + * This property is set only if the task runs in a container context. + */ + @JsonProperty(value = "containerInfo") + private TaskContainerExecutionInformation containerInfo; + + /** + * Information describing the task failure, if any. + * This property is set only if the task is in the completed state and + * encountered a failure. + */ + @JsonProperty(value = "failureInfo") + private TaskFailureInformation failureInfo; + + /** + * The result of the task execution. + * If the value is 'failed', then the details of the failure can be found + * in the failureInfo property. Possible values include: 'success', + * 'failure'. + */ + @JsonProperty(value = "result") + private TaskExecutionResult result; + + /** + * Get if the task has been restarted or retried, this is the most recent time at which the task started running. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set if the task has been restarted or retried, this is the most recent time at which the task started running. + * + * @param startTime the startTime value to set + * @return the JobReleaseTaskExecutionInformation object itself. + */ + public JobReleaseTaskExecutionInformation withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get this property is set only if the task is in the Completed state. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set this property is set only if the task is in the Completed state. + * + * @param endTime the endTime value to set + * @return the JobReleaseTaskExecutionInformation object itself. + */ + public JobReleaseTaskExecutionInformation withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get possible values include: 'running', 'completed'. + * + * @return the state value + */ + public JobReleaseTaskState state() { + return this.state; + } + + /** + * Set possible values include: 'running', 'completed'. + * + * @param state the state value to set + * @return the JobReleaseTaskExecutionInformation object itself. + */ + public JobReleaseTaskExecutionInformation withState(JobReleaseTaskState state) { + this.state = state; + return this; + } + + /** + * Get the taskRootDirectory value. + * + * @return the taskRootDirectory value + */ + public String taskRootDirectory() { + return this.taskRootDirectory; + } + + /** + * Set the taskRootDirectory value. + * + * @param taskRootDirectory the taskRootDirectory value to set + * @return the JobReleaseTaskExecutionInformation object itself. + */ + public JobReleaseTaskExecutionInformation withTaskRootDirectory(String taskRootDirectory) { + this.taskRootDirectory = taskRootDirectory; + return this; + } + + /** + * Get the taskRootDirectoryUrl value. + * + * @return the taskRootDirectoryUrl value + */ + public String taskRootDirectoryUrl() { + return this.taskRootDirectoryUrl; + } + + /** + * Set the taskRootDirectoryUrl value. + * + * @param taskRootDirectoryUrl the taskRootDirectoryUrl value to set + * @return the JobReleaseTaskExecutionInformation object itself. + */ + public JobReleaseTaskExecutionInformation withTaskRootDirectoryUrl(String taskRootDirectoryUrl) { + this.taskRootDirectoryUrl = taskRootDirectoryUrl; + return this; + } + + /** + * Get this parameter is returned only if the task is in the completed state. The exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. Note that the exit code may also be generated by the compute node operating system, such as when a process is forcibly terminated. + * + * @return the exitCode value + */ + public Integer exitCode() { + return this.exitCode; + } + + /** + * Set this parameter is returned only if the task is in the completed state. The exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. Note that the exit code may also be generated by the compute node operating system, such as when a process is forcibly terminated. + * + * @param exitCode the exitCode value to set + * @return the JobReleaseTaskExecutionInformation object itself. + */ + public JobReleaseTaskExecutionInformation withExitCode(Integer exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get this property is set only if the task runs in a container context. + * + * @return the containerInfo value + */ + public TaskContainerExecutionInformation containerInfo() { + return this.containerInfo; + } + + /** + * Set this property is set only if the task runs in a container context. + * + * @param containerInfo the containerInfo value to set + * @return the JobReleaseTaskExecutionInformation object itself. + */ + public JobReleaseTaskExecutionInformation withContainerInfo(TaskContainerExecutionInformation containerInfo) { + this.containerInfo = containerInfo; + return this; + } + + /** + * Get this property is set only if the task is in the completed state and encountered a failure. + * + * @return the failureInfo value + */ + public TaskFailureInformation failureInfo() { + return this.failureInfo; + } + + /** + * Set this property is set only if the task is in the completed state and encountered a failure. + * + * @param failureInfo the failureInfo value to set + * @return the JobReleaseTaskExecutionInformation object itself. + */ + public JobReleaseTaskExecutionInformation withFailureInfo(TaskFailureInformation failureInfo) { + this.failureInfo = failureInfo; + return this; + } + + /** + * Get if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'. + * + * @return the result value + */ + public TaskExecutionResult result() { + return this.result; + } + + /** + * Set if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'. + * + * @param result the result value to set + * @return the JobReleaseTaskExecutionInformation object itself. + */ + public JobReleaseTaskExecutionInformation withResult(TaskExecutionResult result) { + this.result = result; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobReleaseTaskState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobReleaseTaskState.java new file mode 100644 index 000000000000..fcb9019bc7e4 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobReleaseTaskState.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobReleaseTaskState. + */ +public enum JobReleaseTaskState { + /** The task is currently running (including retrying). */ + RUNNING("running"), + + /** The task has exited with exit code 0, or the task has exhausted its retry limit, or the Batch service was unable to start the task due to task preparation errors (such as resource file download failures). */ + COMPLETED("completed"); + + /** The actual serialized value for a JobReleaseTaskState instance. */ + private String value; + + JobReleaseTaskState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobReleaseTaskState instance. + * + * @param value the serialized value to parse. + * @return the parsed JobReleaseTaskState object, or null if unable to parse. + */ + @JsonCreator + public static JobReleaseTaskState fromString(String value) { + JobReleaseTaskState[] items = JobReleaseTaskState.values(); + for (JobReleaseTaskState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleAddHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleAddHeaders.java new file mode 100644 index 000000000000..e427e764366f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleAddHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Add operation. + */ +public class JobScheduleAddHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleAddHeaders object itself. + */ + public JobScheduleAddHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobScheduleAddHeaders object itself. + */ + public JobScheduleAddHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobScheduleAddHeaders object itself. + */ + public JobScheduleAddHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobScheduleAddHeaders object itself. + */ + public JobScheduleAddHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobScheduleAddHeaders object itself. + */ + public JobScheduleAddHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleAddOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleAddOptions.java new file mode 100644 index 000000000000..cbdd56d107e2 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleAddOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for add operation. + */ +public class JobScheduleAddOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobScheduleAddOptions object itself. + */ + public JobScheduleAddOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleAddOptions object itself. + */ + public JobScheduleAddOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobScheduleAddOptions object itself. + */ + public JobScheduleAddOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobScheduleAddOptions object itself. + */ + public JobScheduleAddOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleAddParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleAddParameter.java new file mode 100644 index 000000000000..0aa4809a821f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleAddParameter.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A job schedule that allows recurring jobs by specifying when to run jobs and + * a specification used to create each job. + */ +public class JobScheduleAddParameter { + /** + * A string that uniquely identifies the schedule within the account. + * The ID can contain any combination of alphanumeric characters including + * hyphens and underscores, and cannot contain more than 64 characters. The + * ID is case-preserving and case-insensitive (that is, you may not have + * two IDs within an account that differ only by case). + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The display name for the schedule. + * The display name need not be unique and can contain any Unicode + * characters up to a maximum length of 1024. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The schedule according to which jobs will be created. + */ + @JsonProperty(value = "schedule", required = true) + private Schedule schedule; + + /** + * The details of the jobs to be created on this schedule. + */ + @JsonProperty(value = "jobSpecification", required = true) + private JobSpecification jobSpecification; + + /** + * A list of name-value pairs associated with the schedule as metadata. + * The Batch service does not assign any meaning to metadata; it is solely + * for the use of user code. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Get the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an account that differ only by case). + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an account that differ only by case). + * + * @param id the id value to set + * @return the JobScheduleAddParameter object itself. + */ + public JobScheduleAddParameter withId(String id) { + this.id = id; + return this; + } + + /** + * Get the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @param displayName the displayName value to set + * @return the JobScheduleAddParameter object itself. + */ + public JobScheduleAddParameter withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the schedule value. + * + * @return the schedule value + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set the schedule value. + * + * @param schedule the schedule value to set + * @return the JobScheduleAddParameter object itself. + */ + public JobScheduleAddParameter withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the jobSpecification value. + * + * @return the jobSpecification value + */ + public JobSpecification jobSpecification() { + return this.jobSpecification; + } + + /** + * Set the jobSpecification value. + * + * @param jobSpecification the jobSpecification value to set + * @return the JobScheduleAddParameter object itself. + */ + public JobScheduleAddParameter withJobSpecification(JobSpecification jobSpecification) { + this.jobSpecification = jobSpecification; + return this; + } + + /** + * Get the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @param metadata the metadata value to set + * @return the JobScheduleAddParameter object itself. + */ + public JobScheduleAddParameter withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDeleteHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDeleteHeaders.java new file mode 100644 index 000000000000..6b91ca16145c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDeleteHeaders.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Delete operation. + */ +public class JobScheduleDeleteHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private String clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private String requestId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleDeleteHeaders object itself. + */ + public JobScheduleDeleteHeaders withClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobScheduleDeleteHeaders object itself. + */ + public JobScheduleDeleteHeaders withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDeleteOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDeleteOptions.java new file mode 100644 index 000000000000..9f499a17538e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDeleteOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for delete operation. + */ +public class JobScheduleDeleteOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobScheduleDeleteOptions object itself. + */ + public JobScheduleDeleteOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleDeleteOptions object itself. + */ + public JobScheduleDeleteOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobScheduleDeleteOptions object itself. + */ + public JobScheduleDeleteOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobScheduleDeleteOptions object itself. + */ + public JobScheduleDeleteOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobScheduleDeleteOptions object itself. + */ + public JobScheduleDeleteOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobScheduleDeleteOptions object itself. + */ + public JobScheduleDeleteOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobScheduleDeleteOptions object itself. + */ + public JobScheduleDeleteOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobScheduleDeleteOptions object itself. + */ + public JobScheduleDeleteOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDisableHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDisableHeaders.java new file mode 100644 index 000000000000..c9b09de0c1c7 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDisableHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Disable operation. + */ +public class JobScheduleDisableHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleDisableHeaders object itself. + */ + public JobScheduleDisableHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobScheduleDisableHeaders object itself. + */ + public JobScheduleDisableHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobScheduleDisableHeaders object itself. + */ + public JobScheduleDisableHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobScheduleDisableHeaders object itself. + */ + public JobScheduleDisableHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobScheduleDisableHeaders object itself. + */ + public JobScheduleDisableHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDisableOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDisableOptions.java new file mode 100644 index 000000000000..a70d247ed8ca --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleDisableOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for disable operation. + */ +public class JobScheduleDisableOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobScheduleDisableOptions object itself. + */ + public JobScheduleDisableOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleDisableOptions object itself. + */ + public JobScheduleDisableOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobScheduleDisableOptions object itself. + */ + public JobScheduleDisableOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobScheduleDisableOptions object itself. + */ + public JobScheduleDisableOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobScheduleDisableOptions object itself. + */ + public JobScheduleDisableOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobScheduleDisableOptions object itself. + */ + public JobScheduleDisableOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobScheduleDisableOptions object itself. + */ + public JobScheduleDisableOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobScheduleDisableOptions object itself. + */ + public JobScheduleDisableOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleEnableHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleEnableHeaders.java new file mode 100644 index 000000000000..b482e28a824e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleEnableHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Enable operation. + */ +public class JobScheduleEnableHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleEnableHeaders object itself. + */ + public JobScheduleEnableHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobScheduleEnableHeaders object itself. + */ + public JobScheduleEnableHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobScheduleEnableHeaders object itself. + */ + public JobScheduleEnableHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobScheduleEnableHeaders object itself. + */ + public JobScheduleEnableHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobScheduleEnableHeaders object itself. + */ + public JobScheduleEnableHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleEnableOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleEnableOptions.java new file mode 100644 index 000000000000..a04ab2334335 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleEnableOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for enable operation. + */ +public class JobScheduleEnableOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobScheduleEnableOptions object itself. + */ + public JobScheduleEnableOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleEnableOptions object itself. + */ + public JobScheduleEnableOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobScheduleEnableOptions object itself. + */ + public JobScheduleEnableOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobScheduleEnableOptions object itself. + */ + public JobScheduleEnableOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobScheduleEnableOptions object itself. + */ + public JobScheduleEnableOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobScheduleEnableOptions object itself. + */ + public JobScheduleEnableOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobScheduleEnableOptions object itself. + */ + public JobScheduleEnableOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobScheduleEnableOptions object itself. + */ + public JobScheduleEnableOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleExecutionInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleExecutionInformation.java new file mode 100644 index 000000000000..f1bcefe2ebff --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleExecutionInformation.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about jobs that have been and will be run under a job + * schedule. + */ +public class JobScheduleExecutionInformation { + /** + * The next time at which a job will be created under this schedule. + * This property is meaningful only if the schedule is in the active state + * when the time comes around. For example, if the schedule is disabled, no + * job will be created at nextRunTime unless the job is enabled before + * then. + */ + @JsonProperty(value = "nextRunTime") + private DateTime nextRunTime; + + /** + * Information about the most recent job under the job schedule. + * This property is present only if the at least one job has run under the + * schedule. + */ + @JsonProperty(value = "recentJob") + private RecentJob recentJob; + + /** + * The time at which the schedule ended. + * This property is set only if the job schedule is in the completed state. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * Get this property is meaningful only if the schedule is in the active state when the time comes around. For example, if the schedule is disabled, no job will be created at nextRunTime unless the job is enabled before then. + * + * @return the nextRunTime value + */ + public DateTime nextRunTime() { + return this.nextRunTime; + } + + /** + * Set this property is meaningful only if the schedule is in the active state when the time comes around. For example, if the schedule is disabled, no job will be created at nextRunTime unless the job is enabled before then. + * + * @param nextRunTime the nextRunTime value to set + * @return the JobScheduleExecutionInformation object itself. + */ + public JobScheduleExecutionInformation withNextRunTime(DateTime nextRunTime) { + this.nextRunTime = nextRunTime; + return this; + } + + /** + * Get this property is present only if the at least one job has run under the schedule. + * + * @return the recentJob value + */ + public RecentJob recentJob() { + return this.recentJob; + } + + /** + * Set this property is present only if the at least one job has run under the schedule. + * + * @param recentJob the recentJob value to set + * @return the JobScheduleExecutionInformation object itself. + */ + public JobScheduleExecutionInformation withRecentJob(RecentJob recentJob) { + this.recentJob = recentJob; + return this; + } + + /** + * Get this property is set only if the job schedule is in the completed state. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set this property is set only if the job schedule is in the completed state. + * + * @param endTime the endTime value to set + * @return the JobScheduleExecutionInformation object itself. + */ + public JobScheduleExecutionInformation withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleExistsHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleExistsHeaders.java new file mode 100644 index 000000000000..24ae239e6404 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleExistsHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Exists operation. + */ +public class JobScheduleExistsHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleExistsHeaders object itself. + */ + public JobScheduleExistsHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobScheduleExistsHeaders object itself. + */ + public JobScheduleExistsHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobScheduleExistsHeaders object itself. + */ + public JobScheduleExistsHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobScheduleExistsHeaders object itself. + */ + public JobScheduleExistsHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleExistsOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleExistsOptions.java new file mode 100644 index 000000000000..df2b5e4a738c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleExistsOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for exists operation. + */ +public class JobScheduleExistsOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobScheduleExistsOptions object itself. + */ + public JobScheduleExistsOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleExistsOptions object itself. + */ + public JobScheduleExistsOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobScheduleExistsOptions object itself. + */ + public JobScheduleExistsOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobScheduleExistsOptions object itself. + */ + public JobScheduleExistsOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobScheduleExistsOptions object itself. + */ + public JobScheduleExistsOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobScheduleExistsOptions object itself. + */ + public JobScheduleExistsOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobScheduleExistsOptions object itself. + */ + public JobScheduleExistsOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobScheduleExistsOptions object itself. + */ + public JobScheduleExistsOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleGetHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleGetHeaders.java new file mode 100644 index 000000000000..ce57e63e3ca1 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleGetHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class JobScheduleGetHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleGetHeaders object itself. + */ + public JobScheduleGetHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobScheduleGetHeaders object itself. + */ + public JobScheduleGetHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobScheduleGetHeaders object itself. + */ + public JobScheduleGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobScheduleGetHeaders object itself. + */ + public JobScheduleGetHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleGetOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleGetOptions.java new file mode 100644 index 000000000000..c0f9ce2f954d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleGetOptions.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for get operation. + */ +public class JobScheduleGetOptions { + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * An OData $expand clause. + */ + @JsonProperty(value = "") + private String expand; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the JobScheduleGetOptions object itself. + */ + public JobScheduleGetOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get an OData $expand clause. + * + * @return the expand value + */ + public String expand() { + return this.expand; + } + + /** + * Set an OData $expand clause. + * + * @param expand the expand value to set + * @return the JobScheduleGetOptions object itself. + */ + public JobScheduleGetOptions withExpand(String expand) { + this.expand = expand; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobScheduleGetOptions object itself. + */ + public JobScheduleGetOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleGetOptions object itself. + */ + public JobScheduleGetOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobScheduleGetOptions object itself. + */ + public JobScheduleGetOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobScheduleGetOptions object itself. + */ + public JobScheduleGetOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobScheduleGetOptions object itself. + */ + public JobScheduleGetOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobScheduleGetOptions object itself. + */ + public JobScheduleGetOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobScheduleGetOptions object itself. + */ + public JobScheduleGetOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobScheduleGetOptions object itself. + */ + public JobScheduleGetOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleListHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleListHeaders.java new file mode 100644 index 000000000000..cdc4293e7831 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleListHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for List operation. + */ +public class JobScheduleListHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleListHeaders object itself. + */ + public JobScheduleListHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobScheduleListHeaders object itself. + */ + public JobScheduleListHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobScheduleListHeaders object itself. + */ + public JobScheduleListHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobScheduleListHeaders object itself. + */ + public JobScheduleListHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleListNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleListNextOptions.java new file mode 100644 index 000000000000..3c687ba8fe0e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleListNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listNext operation. + */ +public class JobScheduleListNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleListNextOptions object itself. + */ + public JobScheduleListNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobScheduleListNextOptions object itself. + */ + public JobScheduleListNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobScheduleListNextOptions object itself. + */ + public JobScheduleListNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleListOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleListOptions.java new file mode 100644 index 000000000000..c5c374e31d0a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleListOptions.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for list operation. + */ +public class JobScheduleListOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-schedules. + */ + @JsonProperty(value = "") + private String filter; + + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * An OData $expand clause. + */ + @JsonProperty(value = "") + private String expand; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * job schedules can be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-schedules. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-schedules. + * + * @param filter the filter value to set + * @return the JobScheduleListOptions object itself. + */ + public JobScheduleListOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the JobScheduleListOptions object itself. + */ + public JobScheduleListOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get an OData $expand clause. + * + * @return the expand value + */ + public String expand() { + return this.expand; + } + + /** + * Set an OData $expand clause. + * + * @param expand the expand value to set + * @return the JobScheduleListOptions object itself. + */ + public JobScheduleListOptions withExpand(String expand) { + this.expand = expand; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 job schedules can be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 job schedules can be returned. + * + * @param maxResults the maxResults value to set + * @return the JobScheduleListOptions object itself. + */ + public JobScheduleListOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobScheduleListOptions object itself. + */ + public JobScheduleListOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleListOptions object itself. + */ + public JobScheduleListOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobScheduleListOptions object itself. + */ + public JobScheduleListOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobScheduleListOptions object itself. + */ + public JobScheduleListOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulePatchHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulePatchHeaders.java new file mode 100644 index 000000000000..825b25573d77 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulePatchHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Patch operation. + */ +public class JobSchedulePatchHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobSchedulePatchHeaders object itself. + */ + public JobSchedulePatchHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobSchedulePatchHeaders object itself. + */ + public JobSchedulePatchHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobSchedulePatchHeaders object itself. + */ + public JobSchedulePatchHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobSchedulePatchHeaders object itself. + */ + public JobSchedulePatchHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobSchedulePatchHeaders object itself. + */ + public JobSchedulePatchHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulePatchOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulePatchOptions.java new file mode 100644 index 000000000000..cd3dbe84f349 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulePatchOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for patch operation. + */ +public class JobSchedulePatchOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobSchedulePatchOptions object itself. + */ + public JobSchedulePatchOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobSchedulePatchOptions object itself. + */ + public JobSchedulePatchOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobSchedulePatchOptions object itself. + */ + public JobSchedulePatchOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobSchedulePatchOptions object itself. + */ + public JobSchedulePatchOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobSchedulePatchOptions object itself. + */ + public JobSchedulePatchOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobSchedulePatchOptions object itself. + */ + public JobSchedulePatchOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobSchedulePatchOptions object itself. + */ + public JobSchedulePatchOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobSchedulePatchOptions object itself. + */ + public JobSchedulePatchOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulePatchParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulePatchParameter.java new file mode 100644 index 000000000000..6dc726121564 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulePatchParameter.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of changes to be made to a job schedule. + */ +public class JobSchedulePatchParameter { + /** + * The schedule according to which jobs will be created. + * If you do not specify this element, the existing schedule is left + * unchanged. + */ + @JsonProperty(value = "schedule") + private Schedule schedule; + + /** + * The details of the jobs to be created on this schedule. + * Updates affect only jobs that are started after the update has taken + * place. Any currently active job continues with the older specification. + */ + @JsonProperty(value = "jobSpecification") + private JobSpecification jobSpecification; + + /** + * A list of name-value pairs associated with the job schedule as metadata. + * If you do not specify this element, existing metadata is left unchanged. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Get if you do not specify this element, the existing schedule is left unchanged. + * + * @return the schedule value + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set if you do not specify this element, the existing schedule is left unchanged. + * + * @param schedule the schedule value to set + * @return the JobSchedulePatchParameter object itself. + */ + public JobSchedulePatchParameter withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. + * + * @return the jobSpecification value + */ + public JobSpecification jobSpecification() { + return this.jobSpecification; + } + + /** + * Set updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. + * + * @param jobSpecification the jobSpecification value to set + * @return the JobSchedulePatchParameter object itself. + */ + public JobSchedulePatchParameter withJobSpecification(JobSpecification jobSpecification) { + this.jobSpecification = jobSpecification; + return this; + } + + /** + * Get if you do not specify this element, existing metadata is left unchanged. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set if you do not specify this element, existing metadata is left unchanged. + * + * @param metadata the metadata value to set + * @return the JobSchedulePatchParameter object itself. + */ + public JobSchedulePatchParameter withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleState.java new file mode 100644 index 000000000000..2b731e1e9913 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleState.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobScheduleState. + */ +public enum JobScheduleState { + /** The job schedule is active and will create jobs as per its schedule. */ + ACTIVE("active"), + + /** The schedule has terminated, either by reaching its end time or by the user terminating it explicitly. */ + COMPLETED("completed"), + + /** The user has disabled the schedule. The scheduler will not initiate any new jobs will on this schedule, but any existing active job will continue to run. */ + DISABLED("disabled"), + + /** The schedule has no more work to do, or has been explicitly terminated by the user, but the termination operation is still in progress. The scheduler will not initiate any new jobs for this schedule, nor is any existing job active. */ + TERMINATING("terminating"), + + /** The user has requested that the schedule be deleted, but the delete operation is still in progress. The scheduler will not initiate any new jobs for this schedule, and will delete any existing jobs and tasks under the schedule, including any active job. The schedule will be deleted when all jobs and tasks under the schedule have been deleted. */ + DELETING("deleting"); + + /** The actual serialized value for a JobScheduleState instance. */ + private String value; + + JobScheduleState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobScheduleState instance. + * + * @param value the serialized value to parse. + * @return the parsed JobScheduleState object, or null if unable to parse. + */ + @JsonCreator + public static JobScheduleState fromString(String value) { + JobScheduleState[] items = JobScheduleState.values(); + for (JobScheduleState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleStatistics.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleStatistics.java new file mode 100644 index 000000000000..ade9ccf1a26d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleStatistics.java @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource usage statistics for a job schedule. + */ +public class JobScheduleStatistics { + /** + * The URL of the statistics. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * The start time of the time range covered by the statistics. + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The time at which the statistics were last updated. All statistics are + * limited to the range between startTime and lastUpdateTime. + */ + @JsonProperty(value = "lastUpdateTime", required = true) + private DateTime lastUpdateTime; + + /** + * The total user mode CPU time (summed across all cores and all compute + * nodes) consumed by all tasks in all jobs created under the schedule. + */ + @JsonProperty(value = "userCPUTime", required = true) + private Period userCPUTime; + + /** + * The total kernel mode CPU time (summed across all cores and all compute + * nodes) consumed by all tasks in all jobs created under the schedule. + */ + @JsonProperty(value = "kernelCPUTime", required = true) + private Period kernelCPUTime; + + /** + * The total wall clock time of all the tasks in all the jobs created under + * the schedule. + * The wall clock time is the elapsed time from when the task started + * running on a compute node to when it finished (or to the last time the + * statistics were updated, if the task had not finished by then). If a + * task was retried, this includes the wall clock time of all the task + * retries. + */ + @JsonProperty(value = "wallClockTime", required = true) + private Period wallClockTime; + + /** + * The total number of disk read operations made by all tasks in all jobs + * created under the schedule. + */ + @JsonProperty(value = "readIOps", required = true) + private long readIOps; + + /** + * The total number of disk write operations made by all tasks in all jobs + * created under the schedule. + */ + @JsonProperty(value = "writeIOps", required = true) + private long writeIOps; + + /** + * The total gibibytes read from disk by all tasks in all jobs created + * under the schedule. + */ + @JsonProperty(value = "readIOGiB", required = true) + private double readIOGiB; + + /** + * The total gibibytes written to disk by all tasks in all jobs created + * under the schedule. + */ + @JsonProperty(value = "writeIOGiB", required = true) + private double writeIOGiB; + + /** + * The total number of tasks successfully completed during the given time + * range in jobs created under the schedule. A task completes successfully + * if it returns exit code 0. + */ + @JsonProperty(value = "numSucceededTasks", required = true) + private long numSucceededTasks; + + /** + * The total number of tasks that failed during the given time range in + * jobs created under the schedule. A task fails if it exhausts its maximum + * retry count without returning exit code 0. + */ + @JsonProperty(value = "numFailedTasks", required = true) + private long numFailedTasks; + + /** + * The total number of retries during the given time range on all tasks in + * all jobs created under the schedule. + */ + @JsonProperty(value = "numTaskRetries", required = true) + private long numTaskRetries; + + /** + * The total wait time of all tasks in all jobs created under the schedule. + * The wait time for a task is defined as the elapsed time between the + * creation of the task and the start of task execution. (If the task is + * retried due to failures, the wait time is the time to the most recent + * task execution.). + * This value is only reported in the account lifetime statistics; it is + * not included in the job statistics. + */ + @JsonProperty(value = "waitTime", required = true) + private Period waitTime; + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime value. + * + * @param startTime the startTime value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the lastUpdateTime value. + * + * @return the lastUpdateTime value + */ + public DateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime value. + * + * @param lastUpdateTime the lastUpdateTime value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withLastUpdateTime(DateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the userCPUTime value. + * + * @return the userCPUTime value + */ + public Period userCPUTime() { + return this.userCPUTime; + } + + /** + * Set the userCPUTime value. + * + * @param userCPUTime the userCPUTime value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withUserCPUTime(Period userCPUTime) { + this.userCPUTime = userCPUTime; + return this; + } + + /** + * Get the kernelCPUTime value. + * + * @return the kernelCPUTime value + */ + public Period kernelCPUTime() { + return this.kernelCPUTime; + } + + /** + * Set the kernelCPUTime value. + * + * @param kernelCPUTime the kernelCPUTime value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withKernelCPUTime(Period kernelCPUTime) { + this.kernelCPUTime = kernelCPUTime; + return this; + } + + /** + * Get the wall clock time is the elapsed time from when the task started running on a compute node to when it finished (or to the last time the statistics were updated, if the task had not finished by then). If a task was retried, this includes the wall clock time of all the task retries. + * + * @return the wallClockTime value + */ + public Period wallClockTime() { + return this.wallClockTime; + } + + /** + * Set the wall clock time is the elapsed time from when the task started running on a compute node to when it finished (or to the last time the statistics were updated, if the task had not finished by then). If a task was retried, this includes the wall clock time of all the task retries. + * + * @param wallClockTime the wallClockTime value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withWallClockTime(Period wallClockTime) { + this.wallClockTime = wallClockTime; + return this; + } + + /** + * Get the readIOps value. + * + * @return the readIOps value + */ + public long readIOps() { + return this.readIOps; + } + + /** + * Set the readIOps value. + * + * @param readIOps the readIOps value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withReadIOps(long readIOps) { + this.readIOps = readIOps; + return this; + } + + /** + * Get the writeIOps value. + * + * @return the writeIOps value + */ + public long writeIOps() { + return this.writeIOps; + } + + /** + * Set the writeIOps value. + * + * @param writeIOps the writeIOps value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withWriteIOps(long writeIOps) { + this.writeIOps = writeIOps; + return this; + } + + /** + * Get the readIOGiB value. + * + * @return the readIOGiB value + */ + public double readIOGiB() { + return this.readIOGiB; + } + + /** + * Set the readIOGiB value. + * + * @param readIOGiB the readIOGiB value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withReadIOGiB(double readIOGiB) { + this.readIOGiB = readIOGiB; + return this; + } + + /** + * Get the writeIOGiB value. + * + * @return the writeIOGiB value + */ + public double writeIOGiB() { + return this.writeIOGiB; + } + + /** + * Set the writeIOGiB value. + * + * @param writeIOGiB the writeIOGiB value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withWriteIOGiB(double writeIOGiB) { + this.writeIOGiB = writeIOGiB; + return this; + } + + /** + * Get the numSucceededTasks value. + * + * @return the numSucceededTasks value + */ + public long numSucceededTasks() { + return this.numSucceededTasks; + } + + /** + * Set the numSucceededTasks value. + * + * @param numSucceededTasks the numSucceededTasks value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withNumSucceededTasks(long numSucceededTasks) { + this.numSucceededTasks = numSucceededTasks; + return this; + } + + /** + * Get the numFailedTasks value. + * + * @return the numFailedTasks value + */ + public long numFailedTasks() { + return this.numFailedTasks; + } + + /** + * Set the numFailedTasks value. + * + * @param numFailedTasks the numFailedTasks value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withNumFailedTasks(long numFailedTasks) { + this.numFailedTasks = numFailedTasks; + return this; + } + + /** + * Get the numTaskRetries value. + * + * @return the numTaskRetries value + */ + public long numTaskRetries() { + return this.numTaskRetries; + } + + /** + * Set the numTaskRetries value. + * + * @param numTaskRetries the numTaskRetries value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withNumTaskRetries(long numTaskRetries) { + this.numTaskRetries = numTaskRetries; + return this; + } + + /** + * Get this value is only reported in the account lifetime statistics; it is not included in the job statistics. + * + * @return the waitTime value + */ + public Period waitTime() { + return this.waitTime; + } + + /** + * Set this value is only reported in the account lifetime statistics; it is not included in the job statistics. + * + * @param waitTime the waitTime value to set + * @return the JobScheduleStatistics object itself. + */ + public JobScheduleStatistics withWaitTime(Period waitTime) { + this.waitTime = waitTime; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleTerminateHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleTerminateHeaders.java new file mode 100644 index 000000000000..c2682c32ecbb --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleTerminateHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Terminate operation. + */ +public class JobScheduleTerminateHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleTerminateHeaders object itself. + */ + public JobScheduleTerminateHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobScheduleTerminateHeaders object itself. + */ + public JobScheduleTerminateHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobScheduleTerminateHeaders object itself. + */ + public JobScheduleTerminateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobScheduleTerminateHeaders object itself. + */ + public JobScheduleTerminateHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobScheduleTerminateHeaders object itself. + */ + public JobScheduleTerminateHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleTerminateOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleTerminateOptions.java new file mode 100644 index 000000000000..b8df230d2051 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleTerminateOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for terminate operation. + */ +public class JobScheduleTerminateOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobScheduleTerminateOptions object itself. + */ + public JobScheduleTerminateOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleTerminateOptions object itself. + */ + public JobScheduleTerminateOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobScheduleTerminateOptions object itself. + */ + public JobScheduleTerminateOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobScheduleTerminateOptions object itself. + */ + public JobScheduleTerminateOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobScheduleTerminateOptions object itself. + */ + public JobScheduleTerminateOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobScheduleTerminateOptions object itself. + */ + public JobScheduleTerminateOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobScheduleTerminateOptions object itself. + */ + public JobScheduleTerminateOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobScheduleTerminateOptions object itself. + */ + public JobScheduleTerminateOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleUpdateHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleUpdateHeaders.java new file mode 100644 index 000000000000..e336aa6051c8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleUpdateHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Update operation. + */ +public class JobScheduleUpdateHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleUpdateHeaders object itself. + */ + public JobScheduleUpdateHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobScheduleUpdateHeaders object itself. + */ + public JobScheduleUpdateHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobScheduleUpdateHeaders object itself. + */ + public JobScheduleUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobScheduleUpdateHeaders object itself. + */ + public JobScheduleUpdateHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobScheduleUpdateHeaders object itself. + */ + public JobScheduleUpdateHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleUpdateOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleUpdateOptions.java new file mode 100644 index 000000000000..e0766b418a39 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleUpdateOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for update operation. + */ +public class JobScheduleUpdateOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobScheduleUpdateOptions object itself. + */ + public JobScheduleUpdateOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobScheduleUpdateOptions object itself. + */ + public JobScheduleUpdateOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobScheduleUpdateOptions object itself. + */ + public JobScheduleUpdateOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobScheduleUpdateOptions object itself. + */ + public JobScheduleUpdateOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobScheduleUpdateOptions object itself. + */ + public JobScheduleUpdateOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobScheduleUpdateOptions object itself. + */ + public JobScheduleUpdateOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobScheduleUpdateOptions object itself. + */ + public JobScheduleUpdateOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobScheduleUpdateOptions object itself. + */ + public JobScheduleUpdateOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleUpdateParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleUpdateParameter.java new file mode 100644 index 000000000000..677da62c6592 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobScheduleUpdateParameter.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of changes to be made to a job schedule. + */ +public class JobScheduleUpdateParameter { + /** + * The schedule according to which jobs will be created. + * If you do not specify this element, it is equivalent to passing the + * default schedule: that is, a single job scheduled to run immediately. + */ + @JsonProperty(value = "schedule", required = true) + private Schedule schedule; + + /** + * Details of the jobs to be created on this schedule. + * Updates affect only jobs that are started after the update has taken + * place. Any currently active job continues with the older specification. + */ + @JsonProperty(value = "jobSpecification", required = true) + private JobSpecification jobSpecification; + + /** + * A list of name-value pairs associated with the job schedule as metadata. + * If you do not specify this element, it takes the default value of an + * empty list; in effect, any existing metadata is deleted. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Get if you do not specify this element, it is equivalent to passing the default schedule: that is, a single job scheduled to run immediately. + * + * @return the schedule value + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set if you do not specify this element, it is equivalent to passing the default schedule: that is, a single job scheduled to run immediately. + * + * @param schedule the schedule value to set + * @return the JobScheduleUpdateParameter object itself. + */ + public JobScheduleUpdateParameter withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. + * + * @return the jobSpecification value + */ + public JobSpecification jobSpecification() { + return this.jobSpecification; + } + + /** + * Set updates affect only jobs that are started after the update has taken place. Any currently active job continues with the older specification. + * + * @param jobSpecification the jobSpecification value to set + * @return the JobScheduleUpdateParameter object itself. + */ + public JobScheduleUpdateParameter withJobSpecification(JobSpecification jobSpecification) { + this.jobSpecification = jobSpecification; + return this; + } + + /** + * Get if you do not specify this element, it takes the default value of an empty list; in effect, any existing metadata is deleted. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set if you do not specify this element, it takes the default value of an empty list; in effect, any existing metadata is deleted. + * + * @param metadata the metadata value to set + * @return the JobScheduleUpdateParameter object itself. + */ + public JobScheduleUpdateParameter withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulingError.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulingError.java new file mode 100644 index 000000000000..8362245a16f2 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSchedulingError.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error encountered by the Batch service when scheduling a job. + */ +public class JobSchedulingError { + /** + * The category of the job scheduling error. + * Possible values include: 'userError', 'serverError'. + */ + @JsonProperty(value = "category", required = true) + private ErrorCategory category; + + /** + * An identifier for the job scheduling error. Codes are invariant and are + * intended to be consumed programmatically. + */ + @JsonProperty(value = "code") + private String code; + + /** + * A message describing the job scheduling error, intended to be suitable + * for display in a user interface. + */ + @JsonProperty(value = "message") + private String message; + + /** + * A list of additional error details related to the scheduling error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get possible values include: 'userError', 'serverError'. + * + * @return the category value + */ + public ErrorCategory category() { + return this.category; + } + + /** + * Set possible values include: 'userError', 'serverError'. + * + * @param category the category value to set + * @return the JobSchedulingError object itself. + */ + public JobSchedulingError withCategory(ErrorCategory category) { + this.category = category; + return this; + } + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the JobSchedulingError object itself. + */ + public JobSchedulingError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the JobSchedulingError object itself. + */ + public JobSchedulingError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the details value. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set the details value. + * + * @param details the details value to set + * @return the JobSchedulingError object itself. + */ + public JobSchedulingError withDetails(List details) { + this.details = details; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSpecification.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSpecification.java new file mode 100644 index 000000000000..91f4900044ea --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobSpecification.java @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies details of the jobs to be created on a schedule. + */ +public class JobSpecification { + /** + * The priority of jobs created under this schedule. + * Priority values can range from -1000 to 1000, with -1000 being the + * lowest priority and 1000 being the highest priority. The default value + * is 0. This priority is used as the default for all jobs under the job + * schedule. You can update a job's priority after it has been created + * using by using the update job API. + */ + @JsonProperty(value = "priority") + private Integer priority; + + /** + * The display name for jobs created under this schedule. + * The name need not be unique and can contain any Unicode characters up to + * a maximum length of 1024. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Whether tasks in the job can define dependencies on each other. The + * default is false. + */ + @JsonProperty(value = "usesTaskDependencies") + private Boolean usesTaskDependencies; + + /** + * The action the Batch service should take when all tasks in a job created + * under this schedule are in the completed state. + * Note that if a job contains no tasks, then all tasks are considered + * complete. This option is therefore most commonly used with a Job Manager + * task; if you want to use automatic job termination without a Job + * Manager, you should initially set onAllTasksComplete to noaction and + * update the job properties to set onAllTasksComplete to terminatejob once + * you have finished adding tasks. The default is noaction. Possible values + * include: 'noAction', 'terminateJob'. + */ + @JsonProperty(value = "onAllTasksComplete") + private OnAllTasksComplete onAllTasksComplete; + + /** + * The action the Batch service should take when any task fails in a job + * created under this schedule. A task is considered to have failed if it + * have failed if has a failureInfo. A failureInfo is set if the task + * completes with a non-zero exit code after exhausting its retry count, or + * if there was an error starting the task, for example due to a resource + * file download error. + * The default is noaction. Possible values include: 'noAction', + * 'performExitOptionsJobAction'. + */ + @JsonProperty(value = "onTaskFailure") + private OnTaskFailure onTaskFailure; + + /** + * The network configuration for the job. + */ + @JsonProperty(value = "networkConfiguration") + private JobNetworkConfiguration networkConfiguration; + + /** + * The execution constraints for jobs created under this schedule. + */ + @JsonProperty(value = "constraints") + private JobConstraints constraints; + + /** + * The details of a Job Manager task to be launched when a job is started + * under this schedule. + * If the job does not specify a Job Manager task, the user must explicitly + * add tasks to the job using the Task API. If the job does specify a Job + * Manager task, the Batch service creates the Job Manager task when the + * job is created, and will try to schedule the Job Manager task before + * scheduling other tasks in the job. + */ + @JsonProperty(value = "jobManagerTask") + private JobManagerTask jobManagerTask; + + /** + * The Job Preparation task for jobs created under this schedule. + * If a job has a Job Preparation task, the Batch service will run the Job + * Preparation task on a compute node before starting any tasks of that job + * on that compute node. + */ + @JsonProperty(value = "jobPreparationTask") + private JobPreparationTask jobPreparationTask; + + /** + * The Job Release task for jobs created under this schedule. + * The primary purpose of the Job Release task is to undo changes to + * compute nodes made by the Job Preparation task. Example activities + * include deleting local files, or shutting down services that were + * started as part of job preparation. A Job Release task cannot be + * specified without also specifying a Job Preparation task for the job. + * The Batch service runs the Job Release task on the compute nodes that + * have run the Job Preparation task. + */ + @JsonProperty(value = "jobReleaseTask") + private JobReleaseTask jobReleaseTask; + + /** + * A list of common environment variable settings. These environment + * variables are set for all tasks in jobs created under this schedule + * (including the Job Manager, Job Preparation and Job Release tasks). + * Individual tasks can override an environment setting specified here by + * specifying the same setting name with a different value. + */ + @JsonProperty(value = "commonEnvironmentSettings") + private List commonEnvironmentSettings; + + /** + * The pool on which the Batch service runs the tasks of jobs created under + * this schedule. + */ + @JsonProperty(value = "poolInfo", required = true) + private PoolInformation poolInfo; + + /** + * A list of name-value pairs associated with each job created under this + * schedule as metadata. + * The Batch service does not assign any meaning to metadata; it is solely + * for the use of user code. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Get priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. This priority is used as the default for all jobs under the job schedule. You can update a job's priority after it has been created using by using the update job API. + * + * @return the priority value + */ + public Integer priority() { + return this.priority; + } + + /** + * Set priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. This priority is used as the default for all jobs under the job schedule. You can update a job's priority after it has been created using by using the update job API. + * + * @param priority the priority value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get the name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @param displayName the displayName value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the usesTaskDependencies value. + * + * @return the usesTaskDependencies value + */ + public Boolean usesTaskDependencies() { + return this.usesTaskDependencies; + } + + /** + * Set the usesTaskDependencies value. + * + * @param usesTaskDependencies the usesTaskDependencies value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withUsesTaskDependencies(Boolean usesTaskDependencies) { + this.usesTaskDependencies = usesTaskDependencies; + return this; + } + + /** + * Get note that if a job contains no tasks, then all tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the job properties to set onAllTasksComplete to terminatejob once you have finished adding tasks. The default is noaction. Possible values include: 'noAction', 'terminateJob'. + * + * @return the onAllTasksComplete value + */ + public OnAllTasksComplete onAllTasksComplete() { + return this.onAllTasksComplete; + } + + /** + * Set note that if a job contains no tasks, then all tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the job properties to set onAllTasksComplete to terminatejob once you have finished adding tasks. The default is noaction. Possible values include: 'noAction', 'terminateJob'. + * + * @param onAllTasksComplete the onAllTasksComplete value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withOnAllTasksComplete(OnAllTasksComplete onAllTasksComplete) { + this.onAllTasksComplete = onAllTasksComplete; + return this; + } + + /** + * Get the default is noaction. Possible values include: 'noAction', 'performExitOptionsJobAction'. + * + * @return the onTaskFailure value + */ + public OnTaskFailure onTaskFailure() { + return this.onTaskFailure; + } + + /** + * Set the default is noaction. Possible values include: 'noAction', 'performExitOptionsJobAction'. + * + * @param onTaskFailure the onTaskFailure value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withOnTaskFailure(OnTaskFailure onTaskFailure) { + this.onTaskFailure = onTaskFailure; + return this; + } + + /** + * Get the networkConfiguration value. + * + * @return the networkConfiguration value + */ + public JobNetworkConfiguration networkConfiguration() { + return this.networkConfiguration; + } + + /** + * Set the networkConfiguration value. + * + * @param networkConfiguration the networkConfiguration value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withNetworkConfiguration(JobNetworkConfiguration networkConfiguration) { + this.networkConfiguration = networkConfiguration; + return this; + } + + /** + * Get the constraints value. + * + * @return the constraints value + */ + public JobConstraints constraints() { + return this.constraints; + } + + /** + * Set the constraints value. + * + * @param constraints the constraints value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withConstraints(JobConstraints constraints) { + this.constraints = constraints; + return this; + } + + /** + * Get if the job does not specify a Job Manager task, the user must explicitly add tasks to the job using the Task API. If the job does specify a Job Manager task, the Batch service creates the Job Manager task when the job is created, and will try to schedule the Job Manager task before scheduling other tasks in the job. + * + * @return the jobManagerTask value + */ + public JobManagerTask jobManagerTask() { + return this.jobManagerTask; + } + + /** + * Set if the job does not specify a Job Manager task, the user must explicitly add tasks to the job using the Task API. If the job does specify a Job Manager task, the Batch service creates the Job Manager task when the job is created, and will try to schedule the Job Manager task before scheduling other tasks in the job. + * + * @param jobManagerTask the jobManagerTask value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withJobManagerTask(JobManagerTask jobManagerTask) { + this.jobManagerTask = jobManagerTask; + return this; + } + + /** + * Get if a job has a Job Preparation task, the Batch service will run the Job Preparation task on a compute node before starting any tasks of that job on that compute node. + * + * @return the jobPreparationTask value + */ + public JobPreparationTask jobPreparationTask() { + return this.jobPreparationTask; + } + + /** + * Set if a job has a Job Preparation task, the Batch service will run the Job Preparation task on a compute node before starting any tasks of that job on that compute node. + * + * @param jobPreparationTask the jobPreparationTask value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withJobPreparationTask(JobPreparationTask jobPreparationTask) { + this.jobPreparationTask = jobPreparationTask; + return this; + } + + /** + * Get the primary purpose of the Job Release task is to undo changes to compute nodes made by the Job Preparation task. Example activities include deleting local files, or shutting down services that were started as part of job preparation. A Job Release task cannot be specified without also specifying a Job Preparation task for the job. The Batch service runs the Job Release task on the compute nodes that have run the Job Preparation task. + * + * @return the jobReleaseTask value + */ + public JobReleaseTask jobReleaseTask() { + return this.jobReleaseTask; + } + + /** + * Set the primary purpose of the Job Release task is to undo changes to compute nodes made by the Job Preparation task. Example activities include deleting local files, or shutting down services that were started as part of job preparation. A Job Release task cannot be specified without also specifying a Job Preparation task for the job. The Batch service runs the Job Release task on the compute nodes that have run the Job Preparation task. + * + * @param jobReleaseTask the jobReleaseTask value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withJobReleaseTask(JobReleaseTask jobReleaseTask) { + this.jobReleaseTask = jobReleaseTask; + return this; + } + + /** + * Get individual tasks can override an environment setting specified here by specifying the same setting name with a different value. + * + * @return the commonEnvironmentSettings value + */ + public List commonEnvironmentSettings() { + return this.commonEnvironmentSettings; + } + + /** + * Set individual tasks can override an environment setting specified here by specifying the same setting name with a different value. + * + * @param commonEnvironmentSettings the commonEnvironmentSettings value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withCommonEnvironmentSettings(List commonEnvironmentSettings) { + this.commonEnvironmentSettings = commonEnvironmentSettings; + return this; + } + + /** + * Get the poolInfo value. + * + * @return the poolInfo value + */ + public PoolInformation poolInfo() { + return this.poolInfo; + } + + /** + * Set the poolInfo value. + * + * @param poolInfo the poolInfo value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withPoolInfo(PoolInformation poolInfo) { + this.poolInfo = poolInfo; + return this; + } + + /** + * Get the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @param metadata the metadata value to set + * @return the JobSpecification object itself. + */ + public JobSpecification withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobState.java new file mode 100644 index 000000000000..fa2a51b0b88b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobState.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobState. + */ +public enum JobState { + /** The job is available to have tasks scheduled. */ + ACTIVE("active"), + + /** A user has requested that the job be disabled, but the disable operation is still in progress (for example, waiting for tasks to terminate). */ + DISABLING("disabling"), + + /** A user has disabled the job. No tasks are running, and no new tasks will be scheduled. */ + DISABLED("disabled"), + + /** A user has requested that the job be enabled, but the enable operation is still in progress. */ + ENABLING("enabling"), + + /** The job is about to complete, either because a Job Manager task has completed or because the user has terminated the job, but the terminate operation is still in progress (for example, because Job Release tasks are running). */ + TERMINATING("terminating"), + + /** All tasks have terminated, and the system will not accept any more tasks or any further changes to the job. */ + COMPLETED("completed"), + + /** A user has requested that the job be deleted, but the delete operation is still in progress (for example, because the system is still terminating running tasks). */ + DELETING("deleting"); + + /** The actual serialized value for a JobState instance. */ + private String value; + + JobState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobState instance. + * + * @param value the serialized value to parse. + * @return the parsed JobState object, or null if unable to parse. + */ + @JsonCreator + public static JobState fromString(String value) { + JobState[] items = JobState.values(); + for (JobState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobStatistics.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobStatistics.java new file mode 100644 index 000000000000..dc06cad1eb37 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobStatistics.java @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource usage statistics for a job. + */ +public class JobStatistics { + /** + * The URL of the statistics. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * The start time of the time range covered by the statistics. + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The time at which the statistics were last updated. All statistics are + * limited to the range between startTime and lastUpdateTime. + */ + @JsonProperty(value = "lastUpdateTime", required = true) + private DateTime lastUpdateTime; + + /** + * The total user mode CPU time (summed across all cores and all compute + * nodes) consumed by all tasks in the job. + */ + @JsonProperty(value = "userCPUTime", required = true) + private Period userCPUTime; + + /** + * The total kernel mode CPU time (summed across all cores and all compute + * nodes) consumed by all tasks in the job. + */ + @JsonProperty(value = "kernelCPUTime", required = true) + private Period kernelCPUTime; + + /** + * The total wall clock time of all tasks in the job. + * The wall clock time is the elapsed time from when the task started + * running on a compute node to when it finished (or to the last time the + * statistics were updated, if the task had not finished by then). If a + * task was retried, this includes the wall clock time of all the task + * retries. + */ + @JsonProperty(value = "wallClockTime", required = true) + private Period wallClockTime; + + /** + * The total number of disk read operations made by all tasks in the job. + */ + @JsonProperty(value = "readIOps", required = true) + private long readIOps; + + /** + * The total number of disk write operations made by all tasks in the job. + */ + @JsonProperty(value = "writeIOps", required = true) + private long writeIOps; + + /** + * The total amount of data in GiB read from disk by all tasks in the job. + */ + @JsonProperty(value = "readIOGiB", required = true) + private double readIOGiB; + + /** + * The total amount of data in GiB written to disk by all tasks in the job. + */ + @JsonProperty(value = "writeIOGiB", required = true) + private double writeIOGiB; + + /** + * The total number of tasks successfully completed in the job during the + * given time range. + * A task completes successfully if it returns exit code 0. + */ + @JsonProperty(value = "numSucceededTasks", required = true) + private long numSucceededTasks; + + /** + * The total number of tasks in the job that failed during the given time + * range. + * A task fails if it exhausts its maximum retry count without returning + * exit code 0. + */ + @JsonProperty(value = "numFailedTasks", required = true) + private long numFailedTasks; + + /** + * The total number of retries on all the tasks in the job during the given + * time range. + */ + @JsonProperty(value = "numTaskRetries", required = true) + private long numTaskRetries; + + /** + * The total wait time of all tasks in the job. + * The wait time for a task is defined as the elapsed time between the + * creation of the task and the start of task execution. (If the task is + * retried due to failures, the wait time is the time to the most recent + * task execution.) This value is only reported in the account lifetime + * statistics; it is not included in the job statistics. + */ + @JsonProperty(value = "waitTime", required = true) + private Period waitTime; + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime value. + * + * @param startTime the startTime value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the lastUpdateTime value. + * + * @return the lastUpdateTime value + */ + public DateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime value. + * + * @param lastUpdateTime the lastUpdateTime value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withLastUpdateTime(DateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the userCPUTime value. + * + * @return the userCPUTime value + */ + public Period userCPUTime() { + return this.userCPUTime; + } + + /** + * Set the userCPUTime value. + * + * @param userCPUTime the userCPUTime value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withUserCPUTime(Period userCPUTime) { + this.userCPUTime = userCPUTime; + return this; + } + + /** + * Get the kernelCPUTime value. + * + * @return the kernelCPUTime value + */ + public Period kernelCPUTime() { + return this.kernelCPUTime; + } + + /** + * Set the kernelCPUTime value. + * + * @param kernelCPUTime the kernelCPUTime value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withKernelCPUTime(Period kernelCPUTime) { + this.kernelCPUTime = kernelCPUTime; + return this; + } + + /** + * Get the wall clock time is the elapsed time from when the task started running on a compute node to when it finished (or to the last time the statistics were updated, if the task had not finished by then). If a task was retried, this includes the wall clock time of all the task retries. + * + * @return the wallClockTime value + */ + public Period wallClockTime() { + return this.wallClockTime; + } + + /** + * Set the wall clock time is the elapsed time from when the task started running on a compute node to when it finished (or to the last time the statistics were updated, if the task had not finished by then). If a task was retried, this includes the wall clock time of all the task retries. + * + * @param wallClockTime the wallClockTime value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withWallClockTime(Period wallClockTime) { + this.wallClockTime = wallClockTime; + return this; + } + + /** + * Get the readIOps value. + * + * @return the readIOps value + */ + public long readIOps() { + return this.readIOps; + } + + /** + * Set the readIOps value. + * + * @param readIOps the readIOps value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withReadIOps(long readIOps) { + this.readIOps = readIOps; + return this; + } + + /** + * Get the writeIOps value. + * + * @return the writeIOps value + */ + public long writeIOps() { + return this.writeIOps; + } + + /** + * Set the writeIOps value. + * + * @param writeIOps the writeIOps value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withWriteIOps(long writeIOps) { + this.writeIOps = writeIOps; + return this; + } + + /** + * Get the readIOGiB value. + * + * @return the readIOGiB value + */ + public double readIOGiB() { + return this.readIOGiB; + } + + /** + * Set the readIOGiB value. + * + * @param readIOGiB the readIOGiB value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withReadIOGiB(double readIOGiB) { + this.readIOGiB = readIOGiB; + return this; + } + + /** + * Get the writeIOGiB value. + * + * @return the writeIOGiB value + */ + public double writeIOGiB() { + return this.writeIOGiB; + } + + /** + * Set the writeIOGiB value. + * + * @param writeIOGiB the writeIOGiB value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withWriteIOGiB(double writeIOGiB) { + this.writeIOGiB = writeIOGiB; + return this; + } + + /** + * Get a task completes successfully if it returns exit code 0. + * + * @return the numSucceededTasks value + */ + public long numSucceededTasks() { + return this.numSucceededTasks; + } + + /** + * Set a task completes successfully if it returns exit code 0. + * + * @param numSucceededTasks the numSucceededTasks value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withNumSucceededTasks(long numSucceededTasks) { + this.numSucceededTasks = numSucceededTasks; + return this; + } + + /** + * Get a task fails if it exhausts its maximum retry count without returning exit code 0. + * + * @return the numFailedTasks value + */ + public long numFailedTasks() { + return this.numFailedTasks; + } + + /** + * Set a task fails if it exhausts its maximum retry count without returning exit code 0. + * + * @param numFailedTasks the numFailedTasks value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withNumFailedTasks(long numFailedTasks) { + this.numFailedTasks = numFailedTasks; + return this; + } + + /** + * Get the numTaskRetries value. + * + * @return the numTaskRetries value + */ + public long numTaskRetries() { + return this.numTaskRetries; + } + + /** + * Set the numTaskRetries value. + * + * @param numTaskRetries the numTaskRetries value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withNumTaskRetries(long numTaskRetries) { + this.numTaskRetries = numTaskRetries; + return this; + } + + /** + * Get the wait time for a task is defined as the elapsed time between the creation of the task and the start of task execution. (If the task is retried due to failures, the wait time is the time to the most recent task execution.) This value is only reported in the account lifetime statistics; it is not included in the job statistics. + * + * @return the waitTime value + */ + public Period waitTime() { + return this.waitTime; + } + + /** + * Set the wait time for a task is defined as the elapsed time between the creation of the task and the start of task execution. (If the task is retried due to failures, the wait time is the time to the most recent task execution.) This value is only reported in the account lifetime statistics; it is not included in the job statistics. + * + * @param waitTime the waitTime value to set + * @return the JobStatistics object itself. + */ + public JobStatistics withWaitTime(Period waitTime) { + this.waitTime = waitTime; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobTerminateHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobTerminateHeaders.java new file mode 100644 index 000000000000..da6ec9344e07 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobTerminateHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Terminate operation. + */ +public class JobTerminateHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobTerminateHeaders object itself. + */ + public JobTerminateHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobTerminateHeaders object itself. + */ + public JobTerminateHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobTerminateHeaders object itself. + */ + public JobTerminateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobTerminateHeaders object itself. + */ + public JobTerminateHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobTerminateHeaders object itself. + */ + public JobTerminateHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobTerminateOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobTerminateOptions.java new file mode 100644 index 000000000000..633826028516 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobTerminateOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for terminate operation. + */ +public class JobTerminateOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobTerminateOptions object itself. + */ + public JobTerminateOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobTerminateOptions object itself. + */ + public JobTerminateOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobTerminateOptions object itself. + */ + public JobTerminateOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobTerminateOptions object itself. + */ + public JobTerminateOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobTerminateOptions object itself. + */ + public JobTerminateOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobTerminateOptions object itself. + */ + public JobTerminateOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobTerminateOptions object itself. + */ + public JobTerminateOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobTerminateOptions object itself. + */ + public JobTerminateOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobTerminateParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobTerminateParameter.java new file mode 100644 index 000000000000..0a4deec830c1 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobTerminateParameter.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Options when terminating a job. + */ +public class JobTerminateParameter { + /** + * The text you want to appear as the job's TerminateReason. The default is + * 'UserTerminate'. + */ + @JsonProperty(value = "terminateReason") + private String terminateReason; + + /** + * Get the terminateReason value. + * + * @return the terminateReason value + */ + public String terminateReason() { + return this.terminateReason; + } + + /** + * Set the terminateReason value. + * + * @param terminateReason the terminateReason value to set + * @return the JobTerminateParameter object itself. + */ + public JobTerminateParameter withTerminateReason(String terminateReason) { + this.terminateReason = terminateReason; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobUpdateHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobUpdateHeaders.java new file mode 100644 index 000000000000..c6bb9ca77eef --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobUpdateHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Update operation. + */ +public class JobUpdateHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobUpdateHeaders object itself. + */ + public JobUpdateHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the JobUpdateHeaders object itself. + */ + public JobUpdateHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the JobUpdateHeaders object itself. + */ + public JobUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the JobUpdateHeaders object itself. + */ + public JobUpdateHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the JobUpdateHeaders object itself. + */ + public JobUpdateHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobUpdateOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobUpdateOptions.java new file mode 100644 index 000000000000..0ad80351c9f6 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobUpdateOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for update operation. + */ +public class JobUpdateOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the JobUpdateOptions object itself. + */ + public JobUpdateOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the JobUpdateOptions object itself. + */ + public JobUpdateOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the JobUpdateOptions object itself. + */ + public JobUpdateOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the JobUpdateOptions object itself. + */ + public JobUpdateOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the JobUpdateOptions object itself. + */ + public JobUpdateOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the JobUpdateOptions object itself. + */ + public JobUpdateOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the JobUpdateOptions object itself. + */ + public JobUpdateOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the JobUpdateOptions object itself. + */ + public JobUpdateOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobUpdateParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobUpdateParameter.java new file mode 100644 index 000000000000..7fc9d0b4ebcb --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/JobUpdateParameter.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of changes to be made to a job. + */ +public class JobUpdateParameter { + /** + * The priority of the job. + * Priority values can range from -1000 to 1000, with -1000 being the + * lowest priority and 1000 being the highest priority. If omitted, it is + * set to the default value 0. + */ + @JsonProperty(value = "priority") + private Integer priority; + + /** + * The execution constraints for the job. + * If omitted, the constraints are cleared. + */ + @JsonProperty(value = "constraints") + private JobConstraints constraints; + + /** + * The pool on which the Batch service runs the job's tasks. + * You may change the pool for a job only when the job is disabled. The + * Update Job call will fail if you include the poolInfo element and the + * job is not disabled. If you specify an autoPoolSpecification + * specification in the poolInfo, only the keepAlive property can be + * updated, and then only if the auto pool has a poolLifetimeOption of job. + */ + @JsonProperty(value = "poolInfo", required = true) + private PoolInformation poolInfo; + + /** + * A list of name-value pairs associated with the job as metadata. + * If omitted, it takes the default value of an empty list; in effect, any + * existing metadata is deleted. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * The action the Batch service should take when all tasks in the job are + * in the completed state. + * If omitted, the completion behavior is set to noaction. If the current + * value is terminatejob, this is an error because a job's completion + * behavior may not be changed from terminatejob to noaction. You may not + * change the value from terminatejob to noaction - that is, once you have + * engaged automatic job termination, you cannot turn it off again. If you + * try to do this, the request fails and Batch returns status code 400 (Bad + * Request) and an 'invalid property value' error response. If you do not + * specify this element in a PUT request, it is equivalent to passing + * noaction. This is an error if the current value is terminatejob. + * Possible values include: 'noAction', 'terminateJob'. + */ + @JsonProperty(value = "onAllTasksComplete") + private OnAllTasksComplete onAllTasksComplete; + + /** + * Get priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If omitted, it is set to the default value 0. + * + * @return the priority value + */ + public Integer priority() { + return this.priority; + } + + /** + * Set priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If omitted, it is set to the default value 0. + * + * @param priority the priority value to set + * @return the JobUpdateParameter object itself. + */ + public JobUpdateParameter withPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get if omitted, the constraints are cleared. + * + * @return the constraints value + */ + public JobConstraints constraints() { + return this.constraints; + } + + /** + * Set if omitted, the constraints are cleared. + * + * @param constraints the constraints value to set + * @return the JobUpdateParameter object itself. + */ + public JobUpdateParameter withConstraints(JobConstraints constraints) { + this.constraints = constraints; + return this; + } + + /** + * Get you may change the pool for a job only when the job is disabled. The Update Job call will fail if you include the poolInfo element and the job is not disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. + * + * @return the poolInfo value + */ + public PoolInformation poolInfo() { + return this.poolInfo; + } + + /** + * Set you may change the pool for a job only when the job is disabled. The Update Job call will fail if you include the poolInfo element and the job is not disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. + * + * @param poolInfo the poolInfo value to set + * @return the JobUpdateParameter object itself. + */ + public JobUpdateParameter withPoolInfo(PoolInformation poolInfo) { + this.poolInfo = poolInfo; + return this; + } + + /** + * Get if omitted, it takes the default value of an empty list; in effect, any existing metadata is deleted. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set if omitted, it takes the default value of an empty list; in effect, any existing metadata is deleted. + * + * @param metadata the metadata value to set + * @return the JobUpdateParameter object itself. + */ + public JobUpdateParameter withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get if omitted, the completion behavior is set to noaction. If the current value is terminatejob, this is an error because a job's completion behavior may not be changed from terminatejob to noaction. You may not change the value from terminatejob to noaction - that is, once you have engaged automatic job termination, you cannot turn it off again. If you try to do this, the request fails and Batch returns status code 400 (Bad Request) and an 'invalid property value' error response. If you do not specify this element in a PUT request, it is equivalent to passing noaction. This is an error if the current value is terminatejob. Possible values include: 'noAction', 'terminateJob'. + * + * @return the onAllTasksComplete value + */ + public OnAllTasksComplete onAllTasksComplete() { + return this.onAllTasksComplete; + } + + /** + * Set if omitted, the completion behavior is set to noaction. If the current value is terminatejob, this is an error because a job's completion behavior may not be changed from terminatejob to noaction. You may not change the value from terminatejob to noaction - that is, once you have engaged automatic job termination, you cannot turn it off again. If you try to do this, the request fails and Batch returns status code 400 (Bad Request) and an 'invalid property value' error response. If you do not specify this element in a PUT request, it is equivalent to passing noaction. This is an error if the current value is terminatejob. Possible values include: 'noAction', 'terminateJob'. + * + * @param onAllTasksComplete the onAllTasksComplete value to set + * @return the JobUpdateParameter object itself. + */ + public JobUpdateParameter withOnAllTasksComplete(OnAllTasksComplete onAllTasksComplete) { + this.onAllTasksComplete = onAllTasksComplete; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/LinuxUserConfiguration.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/LinuxUserConfiguration.java new file mode 100644 index 000000000000..de692d92c535 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/LinuxUserConfiguration.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties used to create a user account on a Linux node. + */ +public class LinuxUserConfiguration { + /** + * The user ID of the user account. + * The uid and gid properties must be specified together or not at all. If + * not specified the underlying operating system picks the uid. + */ + @JsonProperty(value = "uid") + private Integer uid; + + /** + * The group ID for the user account. + * The uid and gid properties must be specified together or not at all. If + * not specified the underlying operating system picks the gid. + */ + @JsonProperty(value = "gid") + private Integer gid; + + /** + * The SSH private key for the user account. + * The private key must not be password protected. The private key is used + * to automatically configure asymmetric-key based authentication for SSH + * between nodes in a Linux pool when the pool's + * enableInterNodeCommunication property is true (it is ignored if + * enableInterNodeCommunication is false). It does this by placing the key + * pair into the user's .ssh directory. If not specified, password-less SSH + * is not configured between nodes (no modification of the user's .ssh + * directory is done). + */ + @JsonProperty(value = "sshPrivateKey") + private String sshPrivateKey; + + /** + * Get the uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. + * + * @return the uid value + */ + public Integer uid() { + return this.uid; + } + + /** + * Set the uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. + * + * @param uid the uid value to set + * @return the LinuxUserConfiguration object itself. + */ + public LinuxUserConfiguration withUid(Integer uid) { + this.uid = uid; + return this; + } + + /** + * Get the uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the gid. + * + * @return the gid value + */ + public Integer gid() { + return this.gid; + } + + /** + * Set the uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the gid. + * + * @param gid the gid value to set + * @return the LinuxUserConfiguration object itself. + */ + public LinuxUserConfiguration withGid(Integer gid) { + this.gid = gid; + return this; + } + + /** + * Get the private key must not be password protected. The private key is used to automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool's enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not configured between nodes (no modification of the user's .ssh directory is done). + * + * @return the sshPrivateKey value + */ + public String sshPrivateKey() { + return this.sshPrivateKey; + } + + /** + * Set the private key must not be password protected. The private key is used to automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool's enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not configured between nodes (no modification of the user's .ssh directory is done). + * + * @param sshPrivateKey the sshPrivateKey value to set + * @return the LinuxUserConfiguration object itself. + */ + public LinuxUserConfiguration withSshPrivateKey(String sshPrivateKey) { + this.sshPrivateKey = sshPrivateKey; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/LoginMode.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/LoginMode.java new file mode 100644 index 000000000000..f0b623f097d3 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/LoginMode.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for LoginMode. + */ +public enum LoginMode { + /** The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is recommended for long running parallel processes. */ + BATCH("batch"), + + /** The LOGON32_LOGON_INTERACTIVE Win32 login mode. UAC is enabled on Windows VirtualMachineConfiguration pools. If this option is used with an elevated user identity in a Windows VirtualMachineConfiguration pool, the user session will not be elevated unless the application executed by the task command line is configured to always require administrative privilege or to always require maximum privilege. */ + INTERACTIVE("interactive"); + + /** The actual serialized value for a LoginMode instance. */ + private String value; + + LoginMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a LoginMode instance. + * + * @param value the serialized value to parse. + * @return the parsed LoginMode object, or null if unable to parse. + */ + @JsonCreator + public static LoginMode fromString(String value) { + LoginMode[] items = LoginMode.values(); + for (LoginMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/MetadataItem.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/MetadataItem.java new file mode 100644 index 000000000000..c670b5c55705 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/MetadataItem.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A name-value pair associated with a Batch service resource. + * The Batch service does not assign any meaning to this metadata; it is solely + * for the use of user code. + */ +public class MetadataItem { + /** + * The name of the metadata item. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The value of the metadata item. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the MetadataItem object itself. + */ + public MetadataItem withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the MetadataItem object itself. + */ + public MetadataItem withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/MultiInstanceSettings.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/MultiInstanceSettings.java new file mode 100644 index 000000000000..1cee09739b0c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/MultiInstanceSettings.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Settings which specify how to run a multi-instance task. + * Multi-instance tasks are commonly used to support MPI tasks. + */ +public class MultiInstanceSettings { + /** + * The number of compute nodes required by the task. + * If omitted, the default is 1. + */ + @JsonProperty(value = "numberOfInstances") + private Integer numberOfInstances; + + /** + * The command line to run on all the compute nodes to enable them to + * coordinate when the primary runs the main task command. + * A typical coordination command line launches a background service and + * verifies that the service is ready to process inter-node messages. + */ + @JsonProperty(value = "coordinationCommandLine", required = true) + private String coordinationCommandLine; + + /** + * A list of files that the Batch service will download before running the + * coordination command line. + * The difference between common resource files and task resource files is + * that common resource files are downloaded for all subtasks including the + * primary, whereas task resource files are downloaded only for the + * primary. Also note that these resource files are not downloaded to the + * task working directory, but instead are downloaded to the task root + * directory (one directory above the working directory). There is a + * maximum size for the list of resource files. When the max size is + * exceeded, the request will fail and the response error code will be + * RequestEntityTooLarge. If this occurs, the collection of ResourceFiles + * must be reduced in size. This can be achieved using .zip files, + * Application Packages, or Docker Containers. + */ + @JsonProperty(value = "commonResourceFiles") + private List commonResourceFiles; + + /** + * Get if omitted, the default is 1. + * + * @return the numberOfInstances value + */ + public Integer numberOfInstances() { + return this.numberOfInstances; + } + + /** + * Set if omitted, the default is 1. + * + * @param numberOfInstances the numberOfInstances value to set + * @return the MultiInstanceSettings object itself. + */ + public MultiInstanceSettings withNumberOfInstances(Integer numberOfInstances) { + this.numberOfInstances = numberOfInstances; + return this; + } + + /** + * Get a typical coordination command line launches a background service and verifies that the service is ready to process inter-node messages. + * + * @return the coordinationCommandLine value + */ + public String coordinationCommandLine() { + return this.coordinationCommandLine; + } + + /** + * Set a typical coordination command line launches a background service and verifies that the service is ready to process inter-node messages. + * + * @param coordinationCommandLine the coordinationCommandLine value to set + * @return the MultiInstanceSettings object itself. + */ + public MultiInstanceSettings withCoordinationCommandLine(String coordinationCommandLine) { + this.coordinationCommandLine = coordinationCommandLine; + return this; + } + + /** + * Get the difference between common resource files and task resource files is that common resource files are downloaded for all subtasks including the primary, whereas task resource files are downloaded only for the primary. Also note that these resource files are not downloaded to the task working directory, but instead are downloaded to the task root directory (one directory above the working directory). There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + * + * @return the commonResourceFiles value + */ + public List commonResourceFiles() { + return this.commonResourceFiles; + } + + /** + * Set the difference between common resource files and task resource files is that common resource files are downloaded for all subtasks including the primary, whereas task resource files are downloaded only for the primary. Also note that these resource files are not downloaded to the task working directory, but instead are downloaded to the task root directory (one directory above the working directory). There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + * + * @param commonResourceFiles the commonResourceFiles value to set + * @return the MultiInstanceSettings object itself. + */ + public MultiInstanceSettings withCommonResourceFiles(List commonResourceFiles) { + this.commonResourceFiles = commonResourceFiles; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NameValuePair.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NameValuePair.java new file mode 100644 index 000000000000..eac033b93d5f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NameValuePair.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a name-value pair. + */ +public class NameValuePair { + /** + * The name in the name-value pair. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The value in the name-value pair. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the NameValuePair object itself. + */ + public NameValuePair withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the NameValuePair object itself. + */ + public NameValuePair withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NetworkConfiguration.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NetworkConfiguration.java new file mode 100644 index 000000000000..88620bd93546 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NetworkConfiguration.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The network configuration for a pool. + */ +public class NetworkConfiguration { + /** + * The ARM resource identifier of the virtual network subnet which the + * compute nodes of the pool will join. + * This is of the form + * /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}. + * The virtual network must be in the same region and subscription as the + * Azure Batch account. The specified subnet should have enough free IP + * addresses to accommodate the number of nodes in the pool. If the subnet + * doesn't have enough free IP addresses, the pool will partially allocate + * compute nodes, and a resize error will occur. For pools created with + * virtualMachineConfiguration only ARM virtual networks + * ('Microsoft.Network/virtualNetworks') are supported, but for pools + * created with cloudServiceConfiguration both ARM and classic virtual + * networks are supported. For more details, see: + * https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + */ + @JsonProperty(value = "subnetId") + private String subnetId; + + /** + * The scope of dynamic vnet assignment. + * Possible values include: 'none', 'job'. + */ + @JsonProperty(value = "dynamicVNetAssignmentScope") + private DynamicVNetAssignmentScope dynamicVNetAssignmentScope; + + /** + * The configuration for endpoints on compute nodes in the Batch pool. + * Pool endpoint configuration is only supported on pools with the + * virtualMachineConfiguration property. + */ + @JsonProperty(value = "endpointConfiguration") + private PoolEndpointConfiguration endpointConfiguration; + + /** + * Get this is of the form /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}. The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes, and a resize error will occur. For pools created with virtualMachineConfiguration only ARM virtual networks ('Microsoft.Network/virtualNetworks') are supported, but for pools created with cloudServiceConfiguration both ARM and classic virtual networks are supported. For more details, see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set this is of the form /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}. The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes, and a resize error will occur. For pools created with virtualMachineConfiguration only ARM virtual networks ('Microsoft.Network/virtualNetworks') are supported, but for pools created with cloudServiceConfiguration both ARM and classic virtual networks are supported. For more details, see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + * + * @param subnetId the subnetId value to set + * @return the NetworkConfiguration object itself. + */ + public NetworkConfiguration withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get possible values include: 'none', 'job'. + * + * @return the dynamicVNetAssignmentScope value + */ + public DynamicVNetAssignmentScope dynamicVNetAssignmentScope() { + return this.dynamicVNetAssignmentScope; + } + + /** + * Set possible values include: 'none', 'job'. + * + * @param dynamicVNetAssignmentScope the dynamicVNetAssignmentScope value to set + * @return the NetworkConfiguration object itself. + */ + public NetworkConfiguration withDynamicVNetAssignmentScope(DynamicVNetAssignmentScope dynamicVNetAssignmentScope) { + this.dynamicVNetAssignmentScope = dynamicVNetAssignmentScope; + return this; + } + + /** + * Get pool endpoint configuration is only supported on pools with the virtualMachineConfiguration property. + * + * @return the endpointConfiguration value + */ + public PoolEndpointConfiguration endpointConfiguration() { + return this.endpointConfiguration; + } + + /** + * Set pool endpoint configuration is only supported on pools with the virtualMachineConfiguration property. + * + * @param endpointConfiguration the endpointConfiguration value to set + * @return the NetworkConfiguration object itself. + */ + public NetworkConfiguration withEndpointConfiguration(PoolEndpointConfiguration endpointConfiguration) { + this.endpointConfiguration = endpointConfiguration; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NetworkSecurityGroupRule.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NetworkSecurityGroupRule.java new file mode 100644 index 000000000000..ecf5d078ad57 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NetworkSecurityGroupRule.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A network security group rule to apply to an inbound endpoint. + */ +public class NetworkSecurityGroupRule { + /** + * The priority for this rule. + * Priorities within a pool must be unique and are evaluated in order of + * priority. The lower the number the higher the priority. For example, + * rules could be specified with order numbers of 150, 250, and 350. The + * rule with the order number of 150 takes precedence over the rule that + * has an order of 250. Allowed priorities are 150 to 3500. If any reserved + * or duplicate values are provided the request fails with HTTP status code + * 400. + */ + @JsonProperty(value = "priority", required = true) + private int priority; + + /** + * The action that should be taken for a specified IP address, subnet range + * or tag. + * Possible values include: 'allow', 'deny'. + */ + @JsonProperty(value = "access", required = true) + private NetworkSecurityGroupRuleAccess access; + + /** + * The source address prefix or tag to match for the rule. + * Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. + * 192.168.1.0/24), default tag, or * (for all addresses). If any other + * values are provided the request fails with HTTP status code 400. + */ + @JsonProperty(value = "sourceAddressPrefix", required = true) + private String sourceAddressPrefix; + + /** + * Get priorities within a pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 3500. If any reserved or duplicate values are provided the request fails with HTTP status code 400. + * + * @return the priority value + */ + public int priority() { + return this.priority; + } + + /** + * Set priorities within a pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 3500. If any reserved or duplicate values are provided the request fails with HTTP status code 400. + * + * @param priority the priority value to set + * @return the NetworkSecurityGroupRule object itself. + */ + public NetworkSecurityGroupRule withPriority(int priority) { + this.priority = priority; + return this; + } + + /** + * Get possible values include: 'allow', 'deny'. + * + * @return the access value + */ + public NetworkSecurityGroupRuleAccess access() { + return this.access; + } + + /** + * Set possible values include: 'allow', 'deny'. + * + * @param access the access value to set + * @return the NetworkSecurityGroupRule object itself. + */ + public NetworkSecurityGroupRule withAccess(NetworkSecurityGroupRuleAccess access) { + this.access = access; + return this; + } + + /** + * Get valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. + * + * @return the sourceAddressPrefix value + */ + public String sourceAddressPrefix() { + return this.sourceAddressPrefix; + } + + /** + * Set valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. + * + * @param sourceAddressPrefix the sourceAddressPrefix value to set + * @return the NetworkSecurityGroupRule object itself. + */ + public NetworkSecurityGroupRule withSourceAddressPrefix(String sourceAddressPrefix) { + this.sourceAddressPrefix = sourceAddressPrefix; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NetworkSecurityGroupRuleAccess.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NetworkSecurityGroupRuleAccess.java new file mode 100644 index 000000000000..7cc50dd21f50 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NetworkSecurityGroupRuleAccess.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for NetworkSecurityGroupRuleAccess. + */ +public enum NetworkSecurityGroupRuleAccess { + /** Allow access. */ + ALLOW("allow"), + + /** Deny access. */ + DENY("deny"); + + /** The actual serialized value for a NetworkSecurityGroupRuleAccess instance. */ + private String value; + + NetworkSecurityGroupRuleAccess(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a NetworkSecurityGroupRuleAccess instance. + * + * @param value the serialized value to parse. + * @return the parsed NetworkSecurityGroupRuleAccess object, or null if unable to parse. + */ + @JsonCreator + public static NetworkSecurityGroupRuleAccess fromString(String value) { + NetworkSecurityGroupRuleAccess[] items = NetworkSecurityGroupRuleAccess.values(); + for (NetworkSecurityGroupRuleAccess item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeAgentInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeAgentInformation.java new file mode 100644 index 000000000000..5ae2f9d74a6b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeAgentInformation.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about the node agent. + * The Batch node agent is a program that runs on each node in the pool and + * provides Batch capability on the compute node. + */ +public class NodeAgentInformation { + /** + * The version of the Batch node agent running on the compute node. + * This version number can be checked against the node agent release notes + * located at + * https://github.com/Azure/Batch/blob/master/changelogs/nodeagent/CHANGELOG.md. + */ + @JsonProperty(value = "version", required = true) + private String version; + + /** + * The time when the node agent was updated on the compute node. + * This is the most recent time that the node agent was updated to a new + * version. + */ + @JsonProperty(value = "lastUpdateTime", required = true) + private DateTime lastUpdateTime; + + /** + * Get this version number can be checked against the node agent release notes located at https://github.com/Azure/Batch/blob/master/changelogs/nodeagent/CHANGELOG.md. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set this version number can be checked against the node agent release notes located at https://github.com/Azure/Batch/blob/master/changelogs/nodeagent/CHANGELOG.md. + * + * @param version the version value to set + * @return the NodeAgentInformation object itself. + */ + public NodeAgentInformation withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get this is the most recent time that the node agent was updated to a new version. + * + * @return the lastUpdateTime value + */ + public DateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set this is the most recent time that the node agent was updated to a new version. + * + * @param lastUpdateTime the lastUpdateTime value to set + * @return the NodeAgentInformation object itself. + */ + public NodeAgentInformation withLastUpdateTime(DateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeAgentSku.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeAgentSku.java new file mode 100644 index 000000000000..9168a98fe499 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeAgentSku.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A node agent SKU supported by the Batch service. + * The Batch node agent is a program that runs on each node in the pool, and + * provides the command-and-control interface between the node and the Batch + * service. There are different implementations of the node agent, known as + * SKUs, for different operating systems. + */ +public class NodeAgentSku { + /** + * The ID of the node agent SKU. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The list of Azure Marketplace images verified to be compatible with this + * node agent SKU. + * This collection is not exhaustive (the node agent may be compatible with + * other images). + */ + @JsonProperty(value = "verifiedImageReferences") + private List verifiedImageReferences; + + /** + * The type of operating system (e.g. Windows or Linux) compatible with the + * node agent SKU. + * Possible values include: 'linux', 'windows'. + */ + @JsonProperty(value = "osType") + private OSType osType; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the NodeAgentSku object itself. + */ + public NodeAgentSku withId(String id) { + this.id = id; + return this; + } + + /** + * Get this collection is not exhaustive (the node agent may be compatible with other images). + * + * @return the verifiedImageReferences value + */ + public List verifiedImageReferences() { + return this.verifiedImageReferences; + } + + /** + * Set this collection is not exhaustive (the node agent may be compatible with other images). + * + * @param verifiedImageReferences the verifiedImageReferences value to set + * @return the NodeAgentSku object itself. + */ + public NodeAgentSku withVerifiedImageReferences(List verifiedImageReferences) { + this.verifiedImageReferences = verifiedImageReferences; + return this; + } + + /** + * Get possible values include: 'linux', 'windows'. + * + * @return the osType value + */ + public OSType osType() { + return this.osType; + } + + /** + * Set possible values include: 'linux', 'windows'. + * + * @param osType the osType value to set + * @return the NodeAgentSku object itself. + */ + public NodeAgentSku withOsType(OSType osType) { + this.osType = osType; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeCounts.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeCounts.java new file mode 100644 index 000000000000..77a54a5a9407 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeCounts.java @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The number of nodes in each node state. + */ +public class NodeCounts { + /** + * The number of nodes in the creating state. + */ + @JsonProperty(value = "creating", required = true) + private int creating; + + /** + * The number of nodes in the idle state. + */ + @JsonProperty(value = "idle", required = true) + private int idle; + + /** + * The number of nodes in the offline state. + */ + @JsonProperty(value = "offline", required = true) + private int offline; + + /** + * The number of nodes in the preempted state. + */ + @JsonProperty(value = "preempted", required = true) + private int preempted; + + /** + * The count of nodes in the rebooting state. + */ + @JsonProperty(value = "rebooting", required = true) + private int rebooting; + + /** + * The number of nodes in the reimaging state. + */ + @JsonProperty(value = "reimaging", required = true) + private int reimaging; + + /** + * The number of nodes in the running state. + */ + @JsonProperty(value = "running", required = true) + private int running; + + /** + * The number of nodes in the starting state. + */ + @JsonProperty(value = "starting", required = true) + private int starting; + + /** + * The number of nodes in the startTaskFailed state. + */ + @JsonProperty(value = "startTaskFailed", required = true) + private int startTaskFailed; + + /** + * The number of nodes in the leavingPool state. + */ + @JsonProperty(value = "leavingPool", required = true) + private int leavingPool; + + /** + * The number of nodes in the unknown state. + */ + @JsonProperty(value = "unknown", required = true) + private int unknown; + + /** + * The number of nodes in the unusable state. + */ + @JsonProperty(value = "unusable", required = true) + private int unusable; + + /** + * The number of nodes in the waitingForStartTask state. + */ + @JsonProperty(value = "waitingForStartTask", required = true) + private int waitingForStartTask; + + /** + * The total number of nodes. + */ + @JsonProperty(value = "total", required = true) + private int total; + + /** + * Get the creating value. + * + * @return the creating value + */ + public int creating() { + return this.creating; + } + + /** + * Set the creating value. + * + * @param creating the creating value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withCreating(int creating) { + this.creating = creating; + return this; + } + + /** + * Get the idle value. + * + * @return the idle value + */ + public int idle() { + return this.idle; + } + + /** + * Set the idle value. + * + * @param idle the idle value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withIdle(int idle) { + this.idle = idle; + return this; + } + + /** + * Get the offline value. + * + * @return the offline value + */ + public int offline() { + return this.offline; + } + + /** + * Set the offline value. + * + * @param offline the offline value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withOffline(int offline) { + this.offline = offline; + return this; + } + + /** + * Get the preempted value. + * + * @return the preempted value + */ + public int preempted() { + return this.preempted; + } + + /** + * Set the preempted value. + * + * @param preempted the preempted value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withPreempted(int preempted) { + this.preempted = preempted; + return this; + } + + /** + * Get the rebooting value. + * + * @return the rebooting value + */ + public int rebooting() { + return this.rebooting; + } + + /** + * Set the rebooting value. + * + * @param rebooting the rebooting value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withRebooting(int rebooting) { + this.rebooting = rebooting; + return this; + } + + /** + * Get the reimaging value. + * + * @return the reimaging value + */ + public int reimaging() { + return this.reimaging; + } + + /** + * Set the reimaging value. + * + * @param reimaging the reimaging value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withReimaging(int reimaging) { + this.reimaging = reimaging; + return this; + } + + /** + * Get the running value. + * + * @return the running value + */ + public int running() { + return this.running; + } + + /** + * Set the running value. + * + * @param running the running value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withRunning(int running) { + this.running = running; + return this; + } + + /** + * Get the starting value. + * + * @return the starting value + */ + public int starting() { + return this.starting; + } + + /** + * Set the starting value. + * + * @param starting the starting value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withStarting(int starting) { + this.starting = starting; + return this; + } + + /** + * Get the startTaskFailed value. + * + * @return the startTaskFailed value + */ + public int startTaskFailed() { + return this.startTaskFailed; + } + + /** + * Set the startTaskFailed value. + * + * @param startTaskFailed the startTaskFailed value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withStartTaskFailed(int startTaskFailed) { + this.startTaskFailed = startTaskFailed; + return this; + } + + /** + * Get the leavingPool value. + * + * @return the leavingPool value + */ + public int leavingPool() { + return this.leavingPool; + } + + /** + * Set the leavingPool value. + * + * @param leavingPool the leavingPool value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withLeavingPool(int leavingPool) { + this.leavingPool = leavingPool; + return this; + } + + /** + * Get the unknown value. + * + * @return the unknown value + */ + public int unknown() { + return this.unknown; + } + + /** + * Set the unknown value. + * + * @param unknown the unknown value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withUnknown(int unknown) { + this.unknown = unknown; + return this; + } + + /** + * Get the unusable value. + * + * @return the unusable value + */ + public int unusable() { + return this.unusable; + } + + /** + * Set the unusable value. + * + * @param unusable the unusable value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withUnusable(int unusable) { + this.unusable = unusable; + return this; + } + + /** + * Get the waitingForStartTask value. + * + * @return the waitingForStartTask value + */ + public int waitingForStartTask() { + return this.waitingForStartTask; + } + + /** + * Set the waitingForStartTask value. + * + * @param waitingForStartTask the waitingForStartTask value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withWaitingForStartTask(int waitingForStartTask) { + this.waitingForStartTask = waitingForStartTask; + return this; + } + + /** + * Get the total value. + * + * @return the total value + */ + public int total() { + return this.total; + } + + /** + * Set the total value. + * + * @param total the total value to set + * @return the NodeCounts object itself. + */ + public NodeCounts withTotal(int total) { + this.total = total; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeDisableSchedulingParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeDisableSchedulingParameter.java new file mode 100644 index 000000000000..ae3c8f129ca3 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeDisableSchedulingParameter.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Options for disabling scheduling on a compute node. + */ +public class NodeDisableSchedulingParameter { + /** + * What to do with currently running tasks when disabling task scheduling + * on the compute node. + * The default value is requeue. Possible values include: 'requeue', + * 'terminate', 'taskCompletion'. + */ + @JsonProperty(value = "nodeDisableSchedulingOption") + private DisableComputeNodeSchedulingOption nodeDisableSchedulingOption; + + /** + * Get the default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion'. + * + * @return the nodeDisableSchedulingOption value + */ + public DisableComputeNodeSchedulingOption nodeDisableSchedulingOption() { + return this.nodeDisableSchedulingOption; + } + + /** + * Set the default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion'. + * + * @param nodeDisableSchedulingOption the nodeDisableSchedulingOption value to set + * @return the NodeDisableSchedulingParameter object itself. + */ + public NodeDisableSchedulingParameter withNodeDisableSchedulingOption(DisableComputeNodeSchedulingOption nodeDisableSchedulingOption) { + this.nodeDisableSchedulingOption = nodeDisableSchedulingOption; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeFile.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeFile.java new file mode 100644 index 000000000000..a8edd63e5bb4 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeFile.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a file or directory on a compute node. + */ +public class NodeFile { + /** + * The file path. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The URL of the file. + */ + @JsonProperty(value = "url") + private String url; + + /** + * Whether the object represents a directory. + */ + @JsonProperty(value = "isDirectory") + private Boolean isDirectory; + + /** + * The file properties. + */ + @JsonProperty(value = "properties") + private FileProperties properties; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the NodeFile object itself. + */ + public NodeFile withName(String name) { + this.name = name; + return this; + } + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the NodeFile object itself. + */ + public NodeFile withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the isDirectory value. + * + * @return the isDirectory value + */ + public Boolean isDirectory() { + return this.isDirectory; + } + + /** + * Set the isDirectory value. + * + * @param isDirectory the isDirectory value to set + * @return the NodeFile object itself. + */ + public NodeFile withIsDirectory(Boolean isDirectory) { + this.isDirectory = isDirectory; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public FileProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the NodeFile object itself. + */ + public NodeFile withProperties(FileProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeRebootParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeRebootParameter.java new file mode 100644 index 000000000000..eebb4bc2a008 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeRebootParameter.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Options for rebooting a compute node. + */ +public class NodeRebootParameter { + /** + * When to reboot the compute node and what to do with currently running + * tasks. + * The default value is requeue. Possible values include: 'requeue', + * 'terminate', 'taskCompletion', 'retainedData'. + */ + @JsonProperty(value = "nodeRebootOption") + private ComputeNodeRebootOption nodeRebootOption; + + /** + * Get the default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData'. + * + * @return the nodeRebootOption value + */ + public ComputeNodeRebootOption nodeRebootOption() { + return this.nodeRebootOption; + } + + /** + * Set the default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData'. + * + * @param nodeRebootOption the nodeRebootOption value to set + * @return the NodeRebootParameter object itself. + */ + public NodeRebootParameter withNodeRebootOption(ComputeNodeRebootOption nodeRebootOption) { + this.nodeRebootOption = nodeRebootOption; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeReimageParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeReimageParameter.java new file mode 100644 index 000000000000..7ed12d4ec442 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeReimageParameter.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Options for reimaging a compute node. + */ +public class NodeReimageParameter { + /** + * When to reimage the compute node and what to do with currently running + * tasks. + * The default value is requeue. Possible values include: 'requeue', + * 'terminate', 'taskCompletion', 'retainedData'. + */ + @JsonProperty(value = "nodeReimageOption") + private ComputeNodeReimageOption nodeReimageOption; + + /** + * Get the default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData'. + * + * @return the nodeReimageOption value + */ + public ComputeNodeReimageOption nodeReimageOption() { + return this.nodeReimageOption; + } + + /** + * Set the default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData'. + * + * @param nodeReimageOption the nodeReimageOption value to set + * @return the NodeReimageParameter object itself. + */ + public NodeReimageParameter withNodeReimageOption(ComputeNodeReimageOption nodeReimageOption) { + this.nodeReimageOption = nodeReimageOption; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeRemoveParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeRemoveParameter.java new file mode 100644 index 000000000000..d6f6e0701410 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeRemoveParameter.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Options for removing compute nodes from a pool. + */ +public class NodeRemoveParameter { + /** + * A list containing the IDs of the compute nodes to be removed from the + * specified pool. + */ + @JsonProperty(value = "nodeList", required = true) + private List nodeList; + + /** + * The timeout for removal of compute nodes to the pool. + * The default value is 15 minutes. The minimum value is 5 minutes. If you + * specify a value less than 5 minutes, the Batch service returns an error; + * if you are calling the REST API directly, the HTTP status code is 400 + * (Bad Request). + */ + @JsonProperty(value = "resizeTimeout") + private Period resizeTimeout; + + /** + * Determines what to do with a node and its running task(s) after it has + * been selected for deallocation. + * The default value is requeue. Possible values include: 'requeue', + * 'terminate', 'taskCompletion', 'retainedData'. + */ + @JsonProperty(value = "nodeDeallocationOption") + private ComputeNodeDeallocationOption nodeDeallocationOption; + + /** + * Get the nodeList value. + * + * @return the nodeList value + */ + public List nodeList() { + return this.nodeList; + } + + /** + * Set the nodeList value. + * + * @param nodeList the nodeList value to set + * @return the NodeRemoveParameter object itself. + */ + public NodeRemoveParameter withNodeList(List nodeList) { + this.nodeList = nodeList; + return this; + } + + /** + * Get the default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @return the resizeTimeout value + */ + public Period resizeTimeout() { + return this.resizeTimeout; + } + + /** + * Set the default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @param resizeTimeout the resizeTimeout value to set + * @return the NodeRemoveParameter object itself. + */ + public NodeRemoveParameter withResizeTimeout(Period resizeTimeout) { + this.resizeTimeout = resizeTimeout; + return this; + } + + /** + * Get the default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData'. + * + * @return the nodeDeallocationOption value + */ + public ComputeNodeDeallocationOption nodeDeallocationOption() { + return this.nodeDeallocationOption; + } + + /** + * Set the default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData'. + * + * @param nodeDeallocationOption the nodeDeallocationOption value to set + * @return the NodeRemoveParameter object itself. + */ + public NodeRemoveParameter withNodeDeallocationOption(ComputeNodeDeallocationOption nodeDeallocationOption) { + this.nodeDeallocationOption = nodeDeallocationOption; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeUpdateUserParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeUpdateUserParameter.java new file mode 100644 index 000000000000..7b077bc4bf76 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/NodeUpdateUserParameter.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of changes to be made to a user account on a node. + */ +public class NodeUpdateUserParameter { + /** + * The password of the account. + * The password is required for Windows nodes (those created with + * 'cloudServiceConfiguration', or created with + * 'virtualMachineConfiguration' using a Windows image reference). For + * Linux compute nodes, the password can optionally be specified along with + * the sshPublicKey property. If omitted, any existing password is removed. + */ + @JsonProperty(value = "password") + private String password; + + /** + * The time at which the account should expire. + * If omitted, the default is 1 day from the current time. For Linux + * compute nodes, the expiryTime has a precision up to a day. + */ + @JsonProperty(value = "expiryTime") + private DateTime expiryTime; + + /** + * The SSH public key that can be used for remote login to the compute + * node. + * The public key should be compatible with OpenSSH encoding and should be + * base 64 encoded. This property can be specified only for Linux nodes. If + * this is specified for a Windows node, then the Batch service rejects the + * request; if you are calling the REST API directly, the HTTP status code + * is 400 (Bad Request). If omitted, any existing SSH public key is + * removed. + */ + @JsonProperty(value = "sshPublicKey") + private String sshPublicKey; + + /** + * Get the password is required for Windows nodes (those created with 'cloudServiceConfiguration', or created with 'virtualMachineConfiguration' using a Windows image reference). For Linux compute nodes, the password can optionally be specified along with the sshPublicKey property. If omitted, any existing password is removed. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set the password is required for Windows nodes (those created with 'cloudServiceConfiguration', or created with 'virtualMachineConfiguration' using a Windows image reference). For Linux compute nodes, the password can optionally be specified along with the sshPublicKey property. If omitted, any existing password is removed. + * + * @param password the password value to set + * @return the NodeUpdateUserParameter object itself. + */ + public NodeUpdateUserParameter withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get if omitted, the default is 1 day from the current time. For Linux compute nodes, the expiryTime has a precision up to a day. + * + * @return the expiryTime value + */ + public DateTime expiryTime() { + return this.expiryTime; + } + + /** + * Set if omitted, the default is 1 day from the current time. For Linux compute nodes, the expiryTime has a precision up to a day. + * + * @param expiryTime the expiryTime value to set + * @return the NodeUpdateUserParameter object itself. + */ + public NodeUpdateUserParameter withExpiryTime(DateTime expiryTime) { + this.expiryTime = expiryTime; + return this; + } + + /** + * Get the public key should be compatible with OpenSSH encoding and should be base 64 encoded. This property can be specified only for Linux nodes. If this is specified for a Windows node, then the Batch service rejects the request; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). If omitted, any existing SSH public key is removed. + * + * @return the sshPublicKey value + */ + public String sshPublicKey() { + return this.sshPublicKey; + } + + /** + * Set the public key should be compatible with OpenSSH encoding and should be base 64 encoded. This property can be specified only for Linux nodes. If this is specified for a Windows node, then the Batch service rejects the request; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). If omitted, any existing SSH public key is removed. + * + * @param sshPublicKey the sshPublicKey value to set + * @return the NodeUpdateUserParameter object itself. + */ + public NodeUpdateUserParameter withSshPublicKey(String sshPublicKey) { + this.sshPublicKey = sshPublicKey; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OSType.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OSType.java new file mode 100644 index 000000000000..8fd0f2e5c52f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OSType.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for OSType. + */ +public enum OSType { + /** The Linux operating system. */ + LINUX("linux"), + + /** The Windows operating system. */ + WINDOWS("windows"); + + /** The actual serialized value for a OSType instance. */ + private String value; + + OSType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OSType instance. + * + * @param value the serialized value to parse. + * @return the parsed OSType object, or null if unable to parse. + */ + @JsonCreator + public static OSType fromString(String value) { + OSType[] items = OSType.values(); + for (OSType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OnAllTasksComplete.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OnAllTasksComplete.java new file mode 100644 index 000000000000..38e7c8963c1d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OnAllTasksComplete.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for OnAllTasksComplete. + */ +public enum OnAllTasksComplete { + /** Do nothing. The job remains active unless terminated or disabled by some other means. */ + NO_ACTION("noaction"), + + /** Terminate the job. The job's terminateReason is set to 'AllTasksComplete'. */ + TERMINATE_JOB("terminatejob"); + + /** The actual serialized value for a OnAllTasksComplete instance. */ + private String value; + + OnAllTasksComplete(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OnAllTasksComplete instance. + * + * @param value the serialized value to parse. + * @return the parsed OnAllTasksComplete object, or null if unable to parse. + */ + @JsonCreator + public static OnAllTasksComplete fromString(String value) { + OnAllTasksComplete[] items = OnAllTasksComplete.values(); + for (OnAllTasksComplete item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OnTaskFailure.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OnTaskFailure.java new file mode 100644 index 000000000000..ae90dbdff80a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OnTaskFailure.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for OnTaskFailure. + */ +public enum OnTaskFailure { + /** Do nothing. The job remains active unless terminated or disabled by some other means. */ + NO_ACTION("noaction"), + + /** Take the action associated with the task exit condition in the task's exitConditions collection. (This may still result in no action being taken, if that is what the task specifies.). */ + PERFORM_EXIT_OPTIONS_JOB_ACTION("performexitoptionsjobaction"); + + /** The actual serialized value for a OnTaskFailure instance. */ + private String value; + + OnTaskFailure(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OnTaskFailure instance. + * + * @param value the serialized value to parse. + * @return the parsed OnTaskFailure object, or null if unable to parse. + */ + @JsonCreator + public static OnTaskFailure fromString(String value) { + OnTaskFailure[] items = OnTaskFailure.values(); + for (OnTaskFailure item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFile.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFile.java new file mode 100644 index 000000000000..3aae758c8785 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFile.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A specification for uploading files from an Azure Batch node to another + * location after the Batch service has finished executing the task process. + */ +public class OutputFile { + /** + * A pattern indicating which file(s) to upload. + * Both relative and absolute paths are supported. Relative paths are + * relative to the task working directory. The following wildcards are + * supported: * matches 0 or more characters (for example pattern abc* + * would match abc or abcdef), ** matches any directory, ? matches any + * single character, [abc] matches one character in the brackets, and [a-c] + * matches one character in the range. Brackets can include a negation to + * match any character not specified (for example [!abc] matches any + * character but a, b, or c). If a file name starts with "." it is ignored + * by default but may be matched by specifying it explicitly (for example + * *.gif will not match .a.gif, but .*.gif will). A simple example: + * **\*.txt matches any file that does not start in '.' and ends with .txt + * in the task working directory or any subdirectory. If the filename + * contains a wildcard character it can be escaped using brackets (for + * example abc[*] would match a file named abc*). Note that both \ and / + * are treated as directory separators on Windows, but only / is on Linux. + * Environment variables (%var% on Windows or $var on Linux) are expanded + * prior to the pattern being applied. + */ + @JsonProperty(value = "filePattern", required = true) + private String filePattern; + + /** + * The destination for the output file(s). + */ + @JsonProperty(value = "destination", required = true) + private OutputFileDestination destination; + + /** + * Additional options for the upload operation, including under what + * conditions to perform the upload. + */ + @JsonProperty(value = "uploadOptions", required = true) + private OutputFileUploadOptions uploadOptions; + + /** + * Get both relative and absolute paths are supported. Relative paths are relative to the task working directory. The following wildcards are supported: * matches 0 or more characters (for example pattern abc* would match abc or abcdef), ** matches any directory, ? matches any single character, [abc] matches one character in the brackets, and [a-c] matches one character in the range. Brackets can include a negation to match any character not specified (for example [!abc] matches any character but a, b, or c). If a file name starts with "." it is ignored by default but may be matched by specifying it explicitly (for example *.gif will not match .a.gif, but .*.gif will). A simple example: **\*.txt matches any file that does not start in '.' and ends with .txt in the task working directory or any subdirectory. If the filename contains a wildcard character it can be escaped using brackets (for example abc[*] would match a file named abc*). Note that both \ and / are treated as directory separators on Windows, but only / is on Linux. Environment variables (%var% on Windows or $var on Linux) are expanded prior to the pattern being applied. + * + * @return the filePattern value + */ + public String filePattern() { + return this.filePattern; + } + + /** + * Set both relative and absolute paths are supported. Relative paths are relative to the task working directory. The following wildcards are supported: * matches 0 or more characters (for example pattern abc* would match abc or abcdef), ** matches any directory, ? matches any single character, [abc] matches one character in the brackets, and [a-c] matches one character in the range. Brackets can include a negation to match any character not specified (for example [!abc] matches any character but a, b, or c). If a file name starts with "." it is ignored by default but may be matched by specifying it explicitly (for example *.gif will not match .a.gif, but .*.gif will). A simple example: **\*.txt matches any file that does not start in '.' and ends with .txt in the task working directory or any subdirectory. If the filename contains a wildcard character it can be escaped using brackets (for example abc[*] would match a file named abc*). Note that both \ and / are treated as directory separators on Windows, but only / is on Linux. Environment variables (%var% on Windows or $var on Linux) are expanded prior to the pattern being applied. + * + * @param filePattern the filePattern value to set + * @return the OutputFile object itself. + */ + public OutputFile withFilePattern(String filePattern) { + this.filePattern = filePattern; + return this; + } + + /** + * Get the destination value. + * + * @return the destination value + */ + public OutputFileDestination destination() { + return this.destination; + } + + /** + * Set the destination value. + * + * @param destination the destination value to set + * @return the OutputFile object itself. + */ + public OutputFile withDestination(OutputFileDestination destination) { + this.destination = destination; + return this; + } + + /** + * Get the uploadOptions value. + * + * @return the uploadOptions value + */ + public OutputFileUploadOptions uploadOptions() { + return this.uploadOptions; + } + + /** + * Set the uploadOptions value. + * + * @param uploadOptions the uploadOptions value to set + * @return the OutputFile object itself. + */ + public OutputFile withUploadOptions(OutputFileUploadOptions uploadOptions) { + this.uploadOptions = uploadOptions; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileBlobContainerDestination.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileBlobContainerDestination.java new file mode 100644 index 000000000000..f556c30300bd --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileBlobContainerDestination.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies a file upload destination within an Azure blob storage container. + */ +public class OutputFileBlobContainerDestination { + /** + * The destination blob or virtual directory within the Azure Storage + * container. + * If filePattern refers to a specific file (i.e. contains no wildcards), + * then path is the name of the blob to which to upload that file. If + * filePattern contains one or more wildcards (and therefore may match + * multiple files), then path is the name of the blob virtual directory + * (which is prepended to each blob name) to which to upload the file(s). + * If omitted, file(s) are uploaded to the root of the container with a + * blob name matching their file name. + */ + @JsonProperty(value = "path") + private String path; + + /** + * The URL of the container within Azure Blob Storage to which to upload + * the file(s). + * The URL must include a Shared Access Signature (SAS) granting write + * permissions to the container. + */ + @JsonProperty(value = "containerUrl", required = true) + private String containerUrl; + + /** + * Get if filePattern refers to a specific file (i.e. contains no wildcards), then path is the name of the blob to which to upload that file. If filePattern contains one or more wildcards (and therefore may match multiple files), then path is the name of the blob virtual directory (which is prepended to each blob name) to which to upload the file(s). If omitted, file(s) are uploaded to the root of the container with a blob name matching their file name. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set if filePattern refers to a specific file (i.e. contains no wildcards), then path is the name of the blob to which to upload that file. If filePattern contains one or more wildcards (and therefore may match multiple files), then path is the name of the blob virtual directory (which is prepended to each blob name) to which to upload the file(s). If omitted, file(s) are uploaded to the root of the container with a blob name matching their file name. + * + * @param path the path value to set + * @return the OutputFileBlobContainerDestination object itself. + */ + public OutputFileBlobContainerDestination withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the URL must include a Shared Access Signature (SAS) granting write permissions to the container. + * + * @return the containerUrl value + */ + public String containerUrl() { + return this.containerUrl; + } + + /** + * Set the URL must include a Shared Access Signature (SAS) granting write permissions to the container. + * + * @param containerUrl the containerUrl value to set + * @return the OutputFileBlobContainerDestination object itself. + */ + public OutputFileBlobContainerDestination withContainerUrl(String containerUrl) { + this.containerUrl = containerUrl; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileDestination.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileDestination.java new file mode 100644 index 000000000000..fcd87b1f1c15 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileDestination.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The destination to which a file should be uploaded. + */ +public class OutputFileDestination { + /** + * A location in Azure blob storage to which files are uploaded. + */ + @JsonProperty(value = "container") + private OutputFileBlobContainerDestination container; + + /** + * Get the container value. + * + * @return the container value + */ + public OutputFileBlobContainerDestination container() { + return this.container; + } + + /** + * Set the container value. + * + * @param container the container value to set + * @return the OutputFileDestination object itself. + */ + public OutputFileDestination withContainer(OutputFileBlobContainerDestination container) { + this.container = container; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileUploadCondition.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileUploadCondition.java new file mode 100644 index 000000000000..bf98c3dca7e5 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileUploadCondition.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for OutputFileUploadCondition. + */ +public enum OutputFileUploadCondition { + /** Upload the file(s) only after the task process exits with an exit code of 0. */ + TASK_SUCCESS("tasksuccess"), + + /** Upload the file(s) only after the task process exits with a nonzero exit code. */ + TASK_FAILURE("taskfailure"), + + /** Upload the file(s) after the task process exits, no matter what the exit code was. */ + TASK_COMPLETION("taskcompletion"); + + /** The actual serialized value for a OutputFileUploadCondition instance. */ + private String value; + + OutputFileUploadCondition(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OutputFileUploadCondition instance. + * + * @param value the serialized value to parse. + * @return the parsed OutputFileUploadCondition object, or null if unable to parse. + */ + @JsonCreator + public static OutputFileUploadCondition fromString(String value) { + OutputFileUploadCondition[] items = OutputFileUploadCondition.values(); + for (OutputFileUploadCondition item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileUploadOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileUploadOptions.java new file mode 100644 index 000000000000..d5c7712f2922 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/OutputFileUploadOptions.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about an output file upload operation, including under what + * conditions to perform the upload. + */ +public class OutputFileUploadOptions { + /** + * The conditions under which the task output file or set of files should + * be uploaded. + * The default is taskcompletion. Possible values include: 'taskSuccess', + * 'taskFailure', 'taskCompletion'. + */ + @JsonProperty(value = "uploadCondition", required = true) + private OutputFileUploadCondition uploadCondition; + + /** + * Get the default is taskcompletion. Possible values include: 'taskSuccess', 'taskFailure', 'taskCompletion'. + * + * @return the uploadCondition value + */ + public OutputFileUploadCondition uploadCondition() { + return this.uploadCondition; + } + + /** + * Set the default is taskcompletion. Possible values include: 'taskSuccess', 'taskFailure', 'taskCompletion'. + * + * @param uploadCondition the uploadCondition value to set + * @return the OutputFileUploadOptions object itself. + */ + public OutputFileUploadOptions withUploadCondition(OutputFileUploadCondition uploadCondition) { + this.uploadCondition = uploadCondition; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PageImpl.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PageImpl.java new file mode 100644 index 000000000000..9ae055af65da --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PageImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +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("odata.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/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolAddHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolAddHeaders.java new file mode 100644 index 000000000000..5a82ef98bd16 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolAddHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Add operation. + */ +public class PoolAddHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolAddHeaders object itself. + */ + public PoolAddHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolAddHeaders object itself. + */ + public PoolAddHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolAddHeaders object itself. + */ + public PoolAddHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolAddHeaders object itself. + */ + public PoolAddHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the PoolAddHeaders object itself. + */ + public PoolAddHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolAddOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolAddOptions.java new file mode 100644 index 000000000000..6b22b104cd58 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolAddOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for add operation. + */ +public class PoolAddOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolAddOptions object itself. + */ + public PoolAddOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolAddOptions object itself. + */ + public PoolAddOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolAddOptions object itself. + */ + public PoolAddOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolAddOptions object itself. + */ + public PoolAddOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolAddParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolAddParameter.java new file mode 100644 index 000000000000..050fcb929759 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolAddParameter.java @@ -0,0 +1,639 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.Period; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A pool in the Azure Batch service to add. + */ +public class PoolAddParameter { + /** + * A string that uniquely identifies the pool within the account. + * The ID can contain any combination of alphanumeric characters including + * hyphens and underscores, and cannot contain more than 64 characters. The + * ID is case-preserving and case-insensitive (that is, you may not have + * two pool IDs within an account that differ only by case). + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The display name for the pool. + * The display name need not be unique and can contain any Unicode + * characters up to a maximum length of 1024. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The size of virtual machines in the pool. All virtual machines in a pool + * are the same size. + * For information about available sizes of virtual machines for Cloud + * Services pools (pools created with cloudServiceConfiguration), see Sizes + * for Cloud Services + * (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). + * Batch supports all Cloud Services VM sizes except ExtraSmall, A1V2 and + * A2V2. For information about available VM sizes for pools using images + * from the Virtual Machines Marketplace (pools created with + * virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) + * (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) + * or Sizes for Virtual Machines (Windows) + * (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). + * Batch supports all Azure VM sizes except STANDARD_A0 and those with + * premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). + */ + @JsonProperty(value = "vmSize", required = true) + private String vmSize; + + /** + * The cloud service configuration for the pool. + * This property and virtualMachineConfiguration are mutually exclusive and + * one of the properties must be specified. This property cannot be + * specified if the Batch account was created with its poolAllocationMode + * property set to 'UserSubscription'. + */ + @JsonProperty(value = "cloudServiceConfiguration") + private CloudServiceConfiguration cloudServiceConfiguration; + + /** + * The virtual machine configuration for the pool. + * This property and cloudServiceConfiguration are mutually exclusive and + * one of the properties must be specified. + */ + @JsonProperty(value = "virtualMachineConfiguration") + private VirtualMachineConfiguration virtualMachineConfiguration; + + /** + * The timeout for allocation of compute nodes to the pool. + * This timeout applies only to manual scaling; it has no effect when + * enableAutoScale is set to true. The default value is 15 minutes. The + * minimum value is 5 minutes. If you specify a value less than 5 minutes, + * the Batch service returns an error; if you are calling the REST API + * directly, the HTTP status code is 400 (Bad Request). + */ + @JsonProperty(value = "resizeTimeout") + private Period resizeTimeout; + + /** + * The desired number of dedicated compute nodes in the pool. + * This property must not be specified if enableAutoScale is set to true. + * If enableAutoScale is set to false, then you must set either + * targetDedicatedNodes, targetLowPriorityNodes, or both. + */ + @JsonProperty(value = "targetDedicatedNodes") + private Integer targetDedicatedNodes; + + /** + * The desired number of low-priority compute nodes in the pool. + * This property must not be specified if enableAutoScale is set to true. + * If enableAutoScale is set to false, then you must set either + * targetDedicatedNodes, targetLowPriorityNodes, or both. + */ + @JsonProperty(value = "targetLowPriorityNodes") + private Integer targetLowPriorityNodes; + + /** + * Whether the pool size should automatically adjust over time. + * If false, at least one of targetDedicateNodes and targetLowPriorityNodes + * must be specified. If true, the autoScaleFormula property is required + * and the pool automatically resizes according to the formula. The default + * value is false. + */ + @JsonProperty(value = "enableAutoScale") + private Boolean enableAutoScale; + + /** + * A formula for the desired number of compute nodes in the pool. + * This property must not be specified if enableAutoScale is set to false. + * It is required if enableAutoScale is set to true. The formula is checked + * for validity before the pool is created. If the formula is not valid, + * the Batch service rejects the request with detailed error information. + * For more information about specifying this formula, see 'Automatically + * scale compute nodes in an Azure Batch pool' + * (https://azure.microsoft.com/documentation/articles/batch-automatic-scaling/). + */ + @JsonProperty(value = "autoScaleFormula") + private String autoScaleFormula; + + /** + * The time interval at which to automatically adjust the pool size + * according to the autoscale formula. + * The default value is 15 minutes. The minimum and maximum value are 5 + * minutes and 168 hours respectively. If you specify a value less than 5 + * minutes or greater than 168 hours, the Batch service returns an error; + * if you are calling the REST API directly, the HTTP status code is 400 + * (Bad Request). + */ + @JsonProperty(value = "autoScaleEvaluationInterval") + private Period autoScaleEvaluationInterval; + + /** + * Whether the pool permits direct communication between nodes. + * Enabling inter-node communication limits the maximum size of the pool + * due to deployment restrictions on the nodes of the pool. This may result + * in the pool not reaching its desired size. The default value is false. + */ + @JsonProperty(value = "enableInterNodeCommunication") + private Boolean enableInterNodeCommunication; + + /** + * The network configuration for the pool. + */ + @JsonProperty(value = "networkConfiguration") + private NetworkConfiguration networkConfiguration; + + /** + * A task specified to run on each compute node as it joins the pool. + * The task runs when the node is added to the pool or when the node is + * restarted. + */ + @JsonProperty(value = "startTask") + private StartTask startTask; + + /** + * The list of certificates to be installed on each compute node in the + * pool. + * For Windows compute nodes, the Batch service installs the certificates + * to the specified certificate store and location. For Linux compute + * nodes, the certificates are stored in a directory inside the task + * working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR + * is supplied to the task to query for this location. For certificates + * with visibility of 'remoteUser', a 'certs' directory is created in the + * user's home directory (e.g., /home/{user-name}/certs) and certificates + * are placed in that directory. + */ + @JsonProperty(value = "certificateReferences") + private List certificateReferences; + + /** + * The list of application packages to be installed on each compute node in + * the pool. + */ + @JsonProperty(value = "applicationPackageReferences") + private List applicationPackageReferences; + + /** + * The list of application licenses the Batch service will make available + * on each compute node in the pool. + * The list of application licenses must be a subset of available Batch + * service application licenses. If a license is requested which is not + * supported, pool creation will fail. + */ + @JsonProperty(value = "applicationLicenses") + private List applicationLicenses; + + /** + * The maximum number of tasks that can run concurrently on a single + * compute node in the pool. + * The default value is 1. The maximum value of this setting depends on the + * size of the compute nodes in the pool (the vmSize setting). + */ + @JsonProperty(value = "maxTasksPerNode") + private Integer maxTasksPerNode; + + /** + * How tasks are distributed across compute nodes in a pool. + */ + @JsonProperty(value = "taskSchedulingPolicy") + private TaskSchedulingPolicy taskSchedulingPolicy; + + /** + * The list of user accounts to be created on each node in the pool. + */ + @JsonProperty(value = "userAccounts") + private List userAccounts; + + /** + * A list of name-value pairs associated with the pool as metadata. + * The Batch service does not assign any meaning to metadata; it is solely + * for the use of user code. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Get the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two pool IDs within an account that differ only by case). + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two pool IDs within an account that differ only by case). + * + * @param id the id value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withId(String id) { + this.id = id; + return this; + } + + /** + * Get the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @param displayName the displayName value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get for information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall, A1V2 and A2V2. For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). + * + * @return the vmSize value + */ + public String vmSize() { + return this.vmSize; + } + + /** + * Set for information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall, A1V2 and A2V2. For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). + * + * @param vmSize the vmSize value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withVmSize(String vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get this property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. + * + * @return the cloudServiceConfiguration value + */ + public CloudServiceConfiguration cloudServiceConfiguration() { + return this.cloudServiceConfiguration; + } + + /** + * Set this property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. + * + * @param cloudServiceConfiguration the cloudServiceConfiguration value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withCloudServiceConfiguration(CloudServiceConfiguration cloudServiceConfiguration) { + this.cloudServiceConfiguration = cloudServiceConfiguration; + return this; + } + + /** + * Get this property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. + * + * @return the virtualMachineConfiguration value + */ + public VirtualMachineConfiguration virtualMachineConfiguration() { + return this.virtualMachineConfiguration; + } + + /** + * Set this property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. + * + * @param virtualMachineConfiguration the virtualMachineConfiguration value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withVirtualMachineConfiguration(VirtualMachineConfiguration virtualMachineConfiguration) { + this.virtualMachineConfiguration = virtualMachineConfiguration; + return this; + } + + /** + * Get this timeout applies only to manual scaling; it has no effect when enableAutoScale is set to true. The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @return the resizeTimeout value + */ + public Period resizeTimeout() { + return this.resizeTimeout; + } + + /** + * Set this timeout applies only to manual scaling; it has no effect when enableAutoScale is set to true. The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @param resizeTimeout the resizeTimeout value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withResizeTimeout(Period resizeTimeout) { + this.resizeTimeout = resizeTimeout; + return this; + } + + /** + * Get this property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + * + * @return the targetDedicatedNodes value + */ + public Integer targetDedicatedNodes() { + return this.targetDedicatedNodes; + } + + /** + * Set this property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + * + * @param targetDedicatedNodes the targetDedicatedNodes value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withTargetDedicatedNodes(Integer targetDedicatedNodes) { + this.targetDedicatedNodes = targetDedicatedNodes; + return this; + } + + /** + * Get this property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + * + * @return the targetLowPriorityNodes value + */ + public Integer targetLowPriorityNodes() { + return this.targetLowPriorityNodes; + } + + /** + * Set this property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + * + * @param targetLowPriorityNodes the targetLowPriorityNodes value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withTargetLowPriorityNodes(Integer targetLowPriorityNodes) { + this.targetLowPriorityNodes = targetLowPriorityNodes; + return this; + } + + /** + * Get if false, at least one of targetDedicateNodes and targetLowPriorityNodes must be specified. If true, the autoScaleFormula property is required and the pool automatically resizes according to the formula. The default value is false. + * + * @return the enableAutoScale value + */ + public Boolean enableAutoScale() { + return this.enableAutoScale; + } + + /** + * Set if false, at least one of targetDedicateNodes and targetLowPriorityNodes must be specified. If true, the autoScaleFormula property is required and the pool automatically resizes according to the formula. The default value is false. + * + * @param enableAutoScale the enableAutoScale value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withEnableAutoScale(Boolean enableAutoScale) { + this.enableAutoScale = enableAutoScale; + return this; + } + + /** + * Get this property must not be specified if enableAutoScale is set to false. It is required if enableAutoScale is set to true. The formula is checked for validity before the pool is created. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see 'Automatically scale compute nodes in an Azure Batch pool' (https://azure.microsoft.com/documentation/articles/batch-automatic-scaling/). + * + * @return the autoScaleFormula value + */ + public String autoScaleFormula() { + return this.autoScaleFormula; + } + + /** + * Set this property must not be specified if enableAutoScale is set to false. It is required if enableAutoScale is set to true. The formula is checked for validity before the pool is created. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see 'Automatically scale compute nodes in an Azure Batch pool' (https://azure.microsoft.com/documentation/articles/batch-automatic-scaling/). + * + * @param autoScaleFormula the autoScaleFormula value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withAutoScaleFormula(String autoScaleFormula) { + this.autoScaleFormula = autoScaleFormula; + return this; + } + + /** + * Get the default value is 15 minutes. The minimum and maximum value are 5 minutes and 168 hours respectively. If you specify a value less than 5 minutes or greater than 168 hours, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @return the autoScaleEvaluationInterval value + */ + public Period autoScaleEvaluationInterval() { + return this.autoScaleEvaluationInterval; + } + + /** + * Set the default value is 15 minutes. The minimum and maximum value are 5 minutes and 168 hours respectively. If you specify a value less than 5 minutes or greater than 168 hours, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @param autoScaleEvaluationInterval the autoScaleEvaluationInterval value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withAutoScaleEvaluationInterval(Period autoScaleEvaluationInterval) { + this.autoScaleEvaluationInterval = autoScaleEvaluationInterval; + return this; + } + + /** + * Get enabling inter-node communication limits the maximum size of the pool due to deployment restrictions on the nodes of the pool. This may result in the pool not reaching its desired size. The default value is false. + * + * @return the enableInterNodeCommunication value + */ + public Boolean enableInterNodeCommunication() { + return this.enableInterNodeCommunication; + } + + /** + * Set enabling inter-node communication limits the maximum size of the pool due to deployment restrictions on the nodes of the pool. This may result in the pool not reaching its desired size. The default value is false. + * + * @param enableInterNodeCommunication the enableInterNodeCommunication value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withEnableInterNodeCommunication(Boolean enableInterNodeCommunication) { + this.enableInterNodeCommunication = enableInterNodeCommunication; + return this; + } + + /** + * Get the networkConfiguration value. + * + * @return the networkConfiguration value + */ + public NetworkConfiguration networkConfiguration() { + return this.networkConfiguration; + } + + /** + * Set the networkConfiguration value. + * + * @param networkConfiguration the networkConfiguration value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withNetworkConfiguration(NetworkConfiguration networkConfiguration) { + this.networkConfiguration = networkConfiguration; + return this; + } + + /** + * Get the task runs when the node is added to the pool or when the node is restarted. + * + * @return the startTask value + */ + public StartTask startTask() { + return this.startTask; + } + + /** + * Set the task runs when the node is added to the pool or when the node is restarted. + * + * @param startTask the startTask value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withStartTask(StartTask startTask) { + this.startTask = startTask; + return this; + } + + /** + * Get for Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @return the certificateReferences value + */ + public List certificateReferences() { + return this.certificateReferences; + } + + /** + * Set for Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @param certificateReferences the certificateReferences value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withCertificateReferences(List certificateReferences) { + this.certificateReferences = certificateReferences; + return this; + } + + /** + * Get the applicationPackageReferences value. + * + * @return the applicationPackageReferences value + */ + public List applicationPackageReferences() { + return this.applicationPackageReferences; + } + + /** + * Set the applicationPackageReferences value. + * + * @param applicationPackageReferences the applicationPackageReferences value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withApplicationPackageReferences(List applicationPackageReferences) { + this.applicationPackageReferences = applicationPackageReferences; + return this; + } + + /** + * Get the list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. + * + * @return the applicationLicenses value + */ + public List applicationLicenses() { + return this.applicationLicenses; + } + + /** + * Set the list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. + * + * @param applicationLicenses the applicationLicenses value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withApplicationLicenses(List applicationLicenses) { + this.applicationLicenses = applicationLicenses; + return this; + } + + /** + * Get the default value is 1. The maximum value of this setting depends on the size of the compute nodes in the pool (the vmSize setting). + * + * @return the maxTasksPerNode value + */ + public Integer maxTasksPerNode() { + return this.maxTasksPerNode; + } + + /** + * Set the default value is 1. The maximum value of this setting depends on the size of the compute nodes in the pool (the vmSize setting). + * + * @param maxTasksPerNode the maxTasksPerNode value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withMaxTasksPerNode(Integer maxTasksPerNode) { + this.maxTasksPerNode = maxTasksPerNode; + return this; + } + + /** + * Get the taskSchedulingPolicy value. + * + * @return the taskSchedulingPolicy value + */ + public TaskSchedulingPolicy taskSchedulingPolicy() { + return this.taskSchedulingPolicy; + } + + /** + * Set the taskSchedulingPolicy value. + * + * @param taskSchedulingPolicy the taskSchedulingPolicy value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withTaskSchedulingPolicy(TaskSchedulingPolicy taskSchedulingPolicy) { + this.taskSchedulingPolicy = taskSchedulingPolicy; + return this; + } + + /** + * Get the userAccounts value. + * + * @return the userAccounts value + */ + public List userAccounts() { + return this.userAccounts; + } + + /** + * Set the userAccounts value. + * + * @param userAccounts the userAccounts value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withUserAccounts(List userAccounts) { + this.userAccounts = userAccounts; + return this; + } + + /** + * Get the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @param metadata the metadata value to set + * @return the PoolAddParameter object itself. + */ + public PoolAddParameter withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDeleteHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDeleteHeaders.java new file mode 100644 index 000000000000..d365a31cc72e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDeleteHeaders.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Delete operation. + */ +public class PoolDeleteHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private String clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private String requestId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolDeleteHeaders object itself. + */ + public PoolDeleteHeaders withClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolDeleteHeaders object itself. + */ + public PoolDeleteHeaders withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDeleteOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDeleteOptions.java new file mode 100644 index 000000000000..b768a1cd90b9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDeleteOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for delete operation. + */ +public class PoolDeleteOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolDeleteOptions object itself. + */ + public PoolDeleteOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolDeleteOptions object itself. + */ + public PoolDeleteOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolDeleteOptions object itself. + */ + public PoolDeleteOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolDeleteOptions object itself. + */ + public PoolDeleteOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the PoolDeleteOptions object itself. + */ + public PoolDeleteOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the PoolDeleteOptions object itself. + */ + public PoolDeleteOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the PoolDeleteOptions object itself. + */ + public PoolDeleteOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the PoolDeleteOptions object itself. + */ + public PoolDeleteOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDisableAutoScaleHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDisableAutoScaleHeaders.java new file mode 100644 index 000000000000..6ac5b5aef0c9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDisableAutoScaleHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for DisableAutoScale operation. + */ +public class PoolDisableAutoScaleHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolDisableAutoScaleHeaders object itself. + */ + public PoolDisableAutoScaleHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolDisableAutoScaleHeaders object itself. + */ + public PoolDisableAutoScaleHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolDisableAutoScaleHeaders object itself. + */ + public PoolDisableAutoScaleHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolDisableAutoScaleHeaders object itself. + */ + public PoolDisableAutoScaleHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the PoolDisableAutoScaleHeaders object itself. + */ + public PoolDisableAutoScaleHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDisableAutoScaleOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDisableAutoScaleOptions.java new file mode 100644 index 000000000000..014dca8258ac --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolDisableAutoScaleOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for disableAutoScale operation. + */ +public class PoolDisableAutoScaleOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolDisableAutoScaleOptions object itself. + */ + public PoolDisableAutoScaleOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolDisableAutoScaleOptions object itself. + */ + public PoolDisableAutoScaleOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolDisableAutoScaleOptions object itself. + */ + public PoolDisableAutoScaleOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolDisableAutoScaleOptions object itself. + */ + public PoolDisableAutoScaleOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEnableAutoScaleHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEnableAutoScaleHeaders.java new file mode 100644 index 000000000000..1bab1273eb86 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEnableAutoScaleHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for EnableAutoScale operation. + */ +public class PoolEnableAutoScaleHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolEnableAutoScaleHeaders object itself. + */ + public PoolEnableAutoScaleHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolEnableAutoScaleHeaders object itself. + */ + public PoolEnableAutoScaleHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolEnableAutoScaleHeaders object itself. + */ + public PoolEnableAutoScaleHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolEnableAutoScaleHeaders object itself. + */ + public PoolEnableAutoScaleHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the PoolEnableAutoScaleHeaders object itself. + */ + public PoolEnableAutoScaleHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEnableAutoScaleOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEnableAutoScaleOptions.java new file mode 100644 index 000000000000..1bc7a2a0ebe8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEnableAutoScaleOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for enableAutoScale operation. + */ +public class PoolEnableAutoScaleOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolEnableAutoScaleOptions object itself. + */ + public PoolEnableAutoScaleOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolEnableAutoScaleOptions object itself. + */ + public PoolEnableAutoScaleOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolEnableAutoScaleOptions object itself. + */ + public PoolEnableAutoScaleOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolEnableAutoScaleOptions object itself. + */ + public PoolEnableAutoScaleOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the PoolEnableAutoScaleOptions object itself. + */ + public PoolEnableAutoScaleOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the PoolEnableAutoScaleOptions object itself. + */ + public PoolEnableAutoScaleOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the PoolEnableAutoScaleOptions object itself. + */ + public PoolEnableAutoScaleOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the PoolEnableAutoScaleOptions object itself. + */ + public PoolEnableAutoScaleOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEnableAutoScaleParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEnableAutoScaleParameter.java new file mode 100644 index 000000000000..0164374967b8 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEnableAutoScaleParameter.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Options for enabling automatic scaling on a pool. + */ +public class PoolEnableAutoScaleParameter { + /** + * The formula for the desired number of compute nodes in the pool. + * The formula is checked for validity before it is applied to the pool. If + * the formula is not valid, the Batch service rejects the request with + * detailed error information. For more information about specifying this + * formula, see Automatically scale compute nodes in an Azure Batch pool + * (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + */ + @JsonProperty(value = "autoScaleFormula") + private String autoScaleFormula; + + /** + * The time interval at which to automatically adjust the pool size + * according to the autoscale formula. + * The default value is 15 minutes. The minimum and maximum value are 5 + * minutes and 168 hours respectively. If you specify a value less than 5 + * minutes or greater than 168 hours, the Batch service rejects the request + * with an invalid property value error; if you are calling the REST API + * directly, the HTTP status code is 400 (Bad Request). If you specify a + * new interval, then the existing autoscale evaluation schedule will be + * stopped and a new autoscale evaluation schedule will be started, with + * its starting time being the time when this request was issued. + */ + @JsonProperty(value = "autoScaleEvaluationInterval") + private Period autoScaleEvaluationInterval; + + /** + * Get the formula is checked for validity before it is applied to the pool. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * + * @return the autoScaleFormula value + */ + public String autoScaleFormula() { + return this.autoScaleFormula; + } + + /** + * Set the formula is checked for validity before it is applied to the pool. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * + * @param autoScaleFormula the autoScaleFormula value to set + * @return the PoolEnableAutoScaleParameter object itself. + */ + public PoolEnableAutoScaleParameter withAutoScaleFormula(String autoScaleFormula) { + this.autoScaleFormula = autoScaleFormula; + return this; + } + + /** + * Get the default value is 15 minutes. The minimum and maximum value are 5 minutes and 168 hours respectively. If you specify a value less than 5 minutes or greater than 168 hours, the Batch service rejects the request with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). If you specify a new interval, then the existing autoscale evaluation schedule will be stopped and a new autoscale evaluation schedule will be started, with its starting time being the time when this request was issued. + * + * @return the autoScaleEvaluationInterval value + */ + public Period autoScaleEvaluationInterval() { + return this.autoScaleEvaluationInterval; + } + + /** + * Set the default value is 15 minutes. The minimum and maximum value are 5 minutes and 168 hours respectively. If you specify a value less than 5 minutes or greater than 168 hours, the Batch service rejects the request with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). If you specify a new interval, then the existing autoscale evaluation schedule will be stopped and a new autoscale evaluation schedule will be started, with its starting time being the time when this request was issued. + * + * @param autoScaleEvaluationInterval the autoScaleEvaluationInterval value to set + * @return the PoolEnableAutoScaleParameter object itself. + */ + public PoolEnableAutoScaleParameter withAutoScaleEvaluationInterval(Period autoScaleEvaluationInterval) { + this.autoScaleEvaluationInterval = autoScaleEvaluationInterval; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEndpointConfiguration.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEndpointConfiguration.java new file mode 100644 index 000000000000..e6c50d8e6b10 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEndpointConfiguration.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The endpoint configuration for a pool. + */ +public class PoolEndpointConfiguration { + /** + * A list of inbound NAT pools that can be used to address specific ports + * on an individual compute node externally. + * The maximum number of inbound NAT pools per Batch pool is 5. If the + * maximum number of inbound NAT pools is exceeded the request fails with + * HTTP status code 400. + */ + @JsonProperty(value = "inboundNATPools", required = true) + private List inboundNATPools; + + /** + * Get the maximum number of inbound NAT pools per Batch pool is 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400. + * + * @return the inboundNATPools value + */ + public List inboundNATPools() { + return this.inboundNATPools; + } + + /** + * Set the maximum number of inbound NAT pools per Batch pool is 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400. + * + * @param inboundNATPools the inboundNATPools value to set + * @return the PoolEndpointConfiguration object itself. + */ + public PoolEndpointConfiguration withInboundNATPools(List inboundNATPools) { + this.inboundNATPools = inboundNATPools; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEvaluateAutoScaleHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEvaluateAutoScaleHeaders.java new file mode 100644 index 000000000000..a6b02c68f732 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEvaluateAutoScaleHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for EvaluateAutoScale operation. + */ +public class PoolEvaluateAutoScaleHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolEvaluateAutoScaleHeaders object itself. + */ + public PoolEvaluateAutoScaleHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolEvaluateAutoScaleHeaders object itself. + */ + public PoolEvaluateAutoScaleHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolEvaluateAutoScaleHeaders object itself. + */ + public PoolEvaluateAutoScaleHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolEvaluateAutoScaleHeaders object itself. + */ + public PoolEvaluateAutoScaleHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the PoolEvaluateAutoScaleHeaders object itself. + */ + public PoolEvaluateAutoScaleHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEvaluateAutoScaleOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEvaluateAutoScaleOptions.java new file mode 100644 index 000000000000..d2c3bdcb5a86 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEvaluateAutoScaleOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for evaluateAutoScale operation. + */ +public class PoolEvaluateAutoScaleOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolEvaluateAutoScaleOptions object itself. + */ + public PoolEvaluateAutoScaleOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolEvaluateAutoScaleOptions object itself. + */ + public PoolEvaluateAutoScaleOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolEvaluateAutoScaleOptions object itself. + */ + public PoolEvaluateAutoScaleOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolEvaluateAutoScaleOptions object itself. + */ + public PoolEvaluateAutoScaleOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEvaluateAutoScaleParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEvaluateAutoScaleParameter.java new file mode 100644 index 000000000000..72f391acba6b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolEvaluateAutoScaleParameter.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Options for evaluating an automatic scaling formula on a pool. + */ +public class PoolEvaluateAutoScaleParameter { + /** + * The formula for the desired number of compute nodes in the pool. + * The formula is validated and its results calculated, but it is not + * applied to the pool. To apply the formula to the pool, 'Enable automatic + * scaling on a pool'. For more information about specifying this formula, + * see Automatically scale compute nodes in an Azure Batch pool + * (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + */ + @JsonProperty(value = "autoScaleFormula", required = true) + private String autoScaleFormula; + + /** + * Get the formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * + * @return the autoScaleFormula value + */ + public String autoScaleFormula() { + return this.autoScaleFormula; + } + + /** + * Set the formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + * + * @param autoScaleFormula the autoScaleFormula value to set + * @return the PoolEvaluateAutoScaleParameter object itself. + */ + public PoolEvaluateAutoScaleParameter withAutoScaleFormula(String autoScaleFormula) { + this.autoScaleFormula = autoScaleFormula; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolExistsHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolExistsHeaders.java new file mode 100644 index 000000000000..c4b2480b6158 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolExistsHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Exists operation. + */ +public class PoolExistsHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolExistsHeaders object itself. + */ + public PoolExistsHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolExistsHeaders object itself. + */ + public PoolExistsHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolExistsHeaders object itself. + */ + public PoolExistsHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolExistsHeaders object itself. + */ + public PoolExistsHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolExistsOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolExistsOptions.java new file mode 100644 index 000000000000..cbf65863a3bf --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolExistsOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for exists operation. + */ +public class PoolExistsOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolExistsOptions object itself. + */ + public PoolExistsOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolExistsOptions object itself. + */ + public PoolExistsOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolExistsOptions object itself. + */ + public PoolExistsOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolExistsOptions object itself. + */ + public PoolExistsOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the PoolExistsOptions object itself. + */ + public PoolExistsOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the PoolExistsOptions object itself. + */ + public PoolExistsOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the PoolExistsOptions object itself. + */ + public PoolExistsOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the PoolExistsOptions object itself. + */ + public PoolExistsOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetAllLifetimeStatisticsHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetAllLifetimeStatisticsHeaders.java new file mode 100644 index 000000000000..dc8c0cd32024 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetAllLifetimeStatisticsHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetAllLifetimeStatistics operation. + */ +public class PoolGetAllLifetimeStatisticsHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolGetAllLifetimeStatisticsHeaders object itself. + */ + public PoolGetAllLifetimeStatisticsHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolGetAllLifetimeStatisticsHeaders object itself. + */ + public PoolGetAllLifetimeStatisticsHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolGetAllLifetimeStatisticsHeaders object itself. + */ + public PoolGetAllLifetimeStatisticsHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolGetAllLifetimeStatisticsHeaders object itself. + */ + public PoolGetAllLifetimeStatisticsHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetAllLifetimeStatisticsOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetAllLifetimeStatisticsOptions.java new file mode 100644 index 000000000000..4e9124af4124 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetAllLifetimeStatisticsOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for getAllLifetimeStatistics operation. + */ +public class PoolGetAllLifetimeStatisticsOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolGetAllLifetimeStatisticsOptions object itself. + */ + public PoolGetAllLifetimeStatisticsOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolGetAllLifetimeStatisticsOptions object itself. + */ + public PoolGetAllLifetimeStatisticsOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolGetAllLifetimeStatisticsOptions object itself. + */ + public PoolGetAllLifetimeStatisticsOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolGetAllLifetimeStatisticsOptions object itself. + */ + public PoolGetAllLifetimeStatisticsOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetHeaders.java new file mode 100644 index 000000000000..4bbb42306461 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class PoolGetHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolGetHeaders object itself. + */ + public PoolGetHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolGetHeaders object itself. + */ + public PoolGetHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolGetHeaders object itself. + */ + public PoolGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolGetHeaders object itself. + */ + public PoolGetHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetOptions.java new file mode 100644 index 000000000000..ec21d92596ce --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolGetOptions.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for get operation. + */ +public class PoolGetOptions { + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * An OData $expand clause. + */ + @JsonProperty(value = "") + private String expand; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the PoolGetOptions object itself. + */ + public PoolGetOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get an OData $expand clause. + * + * @return the expand value + */ + public String expand() { + return this.expand; + } + + /** + * Set an OData $expand clause. + * + * @param expand the expand value to set + * @return the PoolGetOptions object itself. + */ + public PoolGetOptions withExpand(String expand) { + this.expand = expand; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolGetOptions object itself. + */ + public PoolGetOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolGetOptions object itself. + */ + public PoolGetOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolGetOptions object itself. + */ + public PoolGetOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolGetOptions object itself. + */ + public PoolGetOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the PoolGetOptions object itself. + */ + public PoolGetOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the PoolGetOptions object itself. + */ + public PoolGetOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the PoolGetOptions object itself. + */ + public PoolGetOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the PoolGetOptions object itself. + */ + public PoolGetOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolInformation.java new file mode 100644 index 000000000000..050b987a22f6 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolInformation.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies how a job should be assigned to a pool. + */ +public class PoolInformation { + /** + * The ID of an existing pool. All the tasks of the job will run on the + * specified pool. + * You must ensure that the pool referenced by this property exists. If the + * pool does not exist at the time the Batch service tries to schedule a + * job, no tasks for the job will run until you create a pool with that id. + * Note that the Batch service will not reject the job request; it will + * simply not run tasks until the pool exists. You must specify either the + * pool ID or the auto pool specification, but not both. + */ + @JsonProperty(value = "poolId") + private String poolId; + + /** + * Characteristics for a temporary 'auto pool'. The Batch service will + * create this auto pool when the job is submitted. + * If auto pool creation fails, the Batch service moves the job to a + * completed state, and the pool creation error is set in the job's + * scheduling error property. The Batch service manages the lifetime (both + * creation and, unless keepAlive is specified, deletion) of the auto pool. + * Any user actions that affect the lifetime of the auto pool while the job + * is active will result in unexpected behavior. You must specify either + * the pool ID or the auto pool specification, but not both. + */ + @JsonProperty(value = "autoPoolSpecification") + private AutoPoolSpecification autoPoolSpecification; + + /** + * Get you must ensure that the pool referenced by this property exists. If the pool does not exist at the time the Batch service tries to schedule a job, no tasks for the job will run until you create a pool with that id. Note that the Batch service will not reject the job request; it will simply not run tasks until the pool exists. You must specify either the pool ID or the auto pool specification, but not both. + * + * @return the poolId value + */ + public String poolId() { + return this.poolId; + } + + /** + * Set you must ensure that the pool referenced by this property exists. If the pool does not exist at the time the Batch service tries to schedule a job, no tasks for the job will run until you create a pool with that id. Note that the Batch service will not reject the job request; it will simply not run tasks until the pool exists. You must specify either the pool ID or the auto pool specification, but not both. + * + * @param poolId the poolId value to set + * @return the PoolInformation object itself. + */ + public PoolInformation withPoolId(String poolId) { + this.poolId = poolId; + return this; + } + + /** + * Get if auto pool creation fails, the Batch service moves the job to a completed state, and the pool creation error is set in the job's scheduling error property. The Batch service manages the lifetime (both creation and, unless keepAlive is specified, deletion) of the auto pool. Any user actions that affect the lifetime of the auto pool while the job is active will result in unexpected behavior. You must specify either the pool ID or the auto pool specification, but not both. + * + * @return the autoPoolSpecification value + */ + public AutoPoolSpecification autoPoolSpecification() { + return this.autoPoolSpecification; + } + + /** + * Set if auto pool creation fails, the Batch service moves the job to a completed state, and the pool creation error is set in the job's scheduling error property. The Batch service manages the lifetime (both creation and, unless keepAlive is specified, deletion) of the auto pool. Any user actions that affect the lifetime of the auto pool while the job is active will result in unexpected behavior. You must specify either the pool ID or the auto pool specification, but not both. + * + * @param autoPoolSpecification the autoPoolSpecification value to set + * @return the PoolInformation object itself. + */ + public PoolInformation withAutoPoolSpecification(AutoPoolSpecification autoPoolSpecification) { + this.autoPoolSpecification = autoPoolSpecification; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolLifetimeOption.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolLifetimeOption.java new file mode 100644 index 000000000000..866c7304051b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolLifetimeOption.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PoolLifetimeOption. + */ +public enum PoolLifetimeOption { + /** The pool exists for the lifetime of the job schedule. The Batch Service creates the pool when it creates the first job on the schedule. You may apply this option only to job schedules, not to jobs. */ + JOB_SCHEDULE("jobschedule"), + + /** The pool exists for the lifetime of the job to which it is dedicated. The Batch service creates the pool when it creates the job. If the 'job' option is applied to a job schedule, the Batch service creates a new auto pool for every job created on the schedule. */ + JOB("job"); + + /** The actual serialized value for a PoolLifetimeOption instance. */ + private String value; + + PoolLifetimeOption(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PoolLifetimeOption instance. + * + * @param value the serialized value to parse. + * @return the parsed PoolLifetimeOption object, or null if unable to parse. + */ + @JsonCreator + public static PoolLifetimeOption fromString(String value) { + PoolLifetimeOption[] items = PoolLifetimeOption.values(); + for (PoolLifetimeOption item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListHeaders.java new file mode 100644 index 000000000000..a7ec4f4e5e6d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for List operation. + */ +public class PoolListHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolListHeaders object itself. + */ + public PoolListHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolListHeaders object itself. + */ + public PoolListHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolListHeaders object itself. + */ + public PoolListHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolListHeaders object itself. + */ + public PoolListHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListNextOptions.java new file mode 100644 index 000000000000..6b69ce56dc2f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listNext operation. + */ +public class PoolListNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolListNextOptions object itself. + */ + public PoolListNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolListNextOptions object itself. + */ + public PoolListNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolListNextOptions object itself. + */ + public PoolListNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListOptions.java new file mode 100644 index 000000000000..3a4362e4150d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListOptions.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for list operation. + */ +public class PoolListOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. + */ + @JsonProperty(value = "") + private String filter; + + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * An OData $expand clause. + */ + @JsonProperty(value = "") + private String expand; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * pools can be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. + * + * @param filter the filter value to set + * @return the PoolListOptions object itself. + */ + public PoolListOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the PoolListOptions object itself. + */ + public PoolListOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get an OData $expand clause. + * + * @return the expand value + */ + public String expand() { + return this.expand; + } + + /** + * Set an OData $expand clause. + * + * @param expand the expand value to set + * @return the PoolListOptions object itself. + */ + public PoolListOptions withExpand(String expand) { + this.expand = expand; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 pools can be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 pools can be returned. + * + * @param maxResults the maxResults value to set + * @return the PoolListOptions object itself. + */ + public PoolListOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolListOptions object itself. + */ + public PoolListOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolListOptions object itself. + */ + public PoolListOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolListOptions object itself. + */ + public PoolListOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolListOptions object itself. + */ + public PoolListOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListUsageMetricsHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListUsageMetricsHeaders.java new file mode 100644 index 000000000000..1c687560ff08 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListUsageMetricsHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for ListUsageMetrics operation. + */ +public class PoolListUsageMetricsHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolListUsageMetricsHeaders object itself. + */ + public PoolListUsageMetricsHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolListUsageMetricsHeaders object itself. + */ + public PoolListUsageMetricsHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolListUsageMetricsHeaders object itself. + */ + public PoolListUsageMetricsHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolListUsageMetricsHeaders object itself. + */ + public PoolListUsageMetricsHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListUsageMetricsNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListUsageMetricsNextOptions.java new file mode 100644 index 000000000000..e848068d52f1 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListUsageMetricsNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listUsageMetricsNext operation. + */ +public class PoolListUsageMetricsNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolListUsageMetricsNextOptions object itself. + */ + public PoolListUsageMetricsNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolListUsageMetricsNextOptions object itself. + */ + public PoolListUsageMetricsNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolListUsageMetricsNextOptions object itself. + */ + public PoolListUsageMetricsNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListUsageMetricsOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListUsageMetricsOptions.java new file mode 100644 index 000000000000..8bcfaabf0688 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolListUsageMetricsOptions.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listUsageMetrics operation. + */ +public class PoolListUsageMetricsOptions { + /** + * The earliest time from which to include metrics. This must be at least + * two and a half hours before the current time. If not specified this + * defaults to the start time of the last aggregation interval currently + * available. + */ + @JsonProperty(value = "") + private DateTime startTime; + + /** + * The latest time from which to include metrics. This must be at least two + * hours before the current time. If not specified this defaults to the end + * time of the last aggregation interval currently available. + */ + @JsonProperty(value = "") + private DateTime endTime; + + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-account-usage-metrics. + */ + @JsonProperty(value = "") + private String filter; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * results will be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the earliest time from which to include metrics. This must be at least two and a half hours before the current time. If not specified this defaults to the start time of the last aggregation interval currently available. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the earliest time from which to include metrics. This must be at least two and a half hours before the current time. If not specified this defaults to the start time of the last aggregation interval currently available. + * + * @param startTime the startTime value to set + * @return the PoolListUsageMetricsOptions object itself. + */ + public PoolListUsageMetricsOptions withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the latest time from which to include metrics. This must be at least two hours before the current time. If not specified this defaults to the end time of the last aggregation interval currently available. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set the latest time from which to include metrics. This must be at least two hours before the current time. If not specified this defaults to the end time of the last aggregation interval currently available. + * + * @param endTime the endTime value to set + * @return the PoolListUsageMetricsOptions object itself. + */ + public PoolListUsageMetricsOptions withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-account-usage-metrics. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-account-usage-metrics. + * + * @param filter the filter value to set + * @return the PoolListUsageMetricsOptions object itself. + */ + public PoolListUsageMetricsOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 results will be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 results will be returned. + * + * @param maxResults the maxResults value to set + * @return the PoolListUsageMetricsOptions object itself. + */ + public PoolListUsageMetricsOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolListUsageMetricsOptions object itself. + */ + public PoolListUsageMetricsOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolListUsageMetricsOptions object itself. + */ + public PoolListUsageMetricsOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolListUsageMetricsOptions object itself. + */ + public PoolListUsageMetricsOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolListUsageMetricsOptions object itself. + */ + public PoolListUsageMetricsOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolNodeCounts.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolNodeCounts.java new file mode 100644 index 000000000000..4caf6f9a9f54 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolNodeCounts.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The number of nodes in each state for a pool. + */ +public class PoolNodeCounts { + /** + * The ID of the pool. + */ + @JsonProperty(value = "poolId", required = true) + private String poolId; + + /** + * The number of dedicated nodes in each state. + */ + @JsonProperty(value = "dedicated") + private NodeCounts dedicated; + + /** + * The number of low priority nodes in each state. + */ + @JsonProperty(value = "lowPriority") + private NodeCounts lowPriority; + + /** + * Get the poolId value. + * + * @return the poolId value + */ + public String poolId() { + return this.poolId; + } + + /** + * Set the poolId value. + * + * @param poolId the poolId value to set + * @return the PoolNodeCounts object itself. + */ + public PoolNodeCounts withPoolId(String poolId) { + this.poolId = poolId; + return this; + } + + /** + * Get the dedicated value. + * + * @return the dedicated value + */ + public NodeCounts dedicated() { + return this.dedicated; + } + + /** + * Set the dedicated value. + * + * @param dedicated the dedicated value to set + * @return the PoolNodeCounts object itself. + */ + public PoolNodeCounts withDedicated(NodeCounts dedicated) { + this.dedicated = dedicated; + return this; + } + + /** + * Get the lowPriority value. + * + * @return the lowPriority value + */ + public NodeCounts lowPriority() { + return this.lowPriority; + } + + /** + * Set the lowPriority value. + * + * @param lowPriority the lowPriority value to set + * @return the PoolNodeCounts object itself. + */ + public PoolNodeCounts withLowPriority(NodeCounts lowPriority) { + this.lowPriority = lowPriority; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolPatchHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolPatchHeaders.java new file mode 100644 index 000000000000..de73d82d26c1 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolPatchHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Patch operation. + */ +public class PoolPatchHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolPatchHeaders object itself. + */ + public PoolPatchHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolPatchHeaders object itself. + */ + public PoolPatchHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolPatchHeaders object itself. + */ + public PoolPatchHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolPatchHeaders object itself. + */ + public PoolPatchHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the PoolPatchHeaders object itself. + */ + public PoolPatchHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolPatchOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolPatchOptions.java new file mode 100644 index 000000000000..41ed88141eaf --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolPatchOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for patch operation. + */ +public class PoolPatchOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolPatchOptions object itself. + */ + public PoolPatchOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolPatchOptions object itself. + */ + public PoolPatchOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolPatchOptions object itself. + */ + public PoolPatchOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolPatchOptions object itself. + */ + public PoolPatchOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the PoolPatchOptions object itself. + */ + public PoolPatchOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the PoolPatchOptions object itself. + */ + public PoolPatchOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the PoolPatchOptions object itself. + */ + public PoolPatchOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the PoolPatchOptions object itself. + */ + public PoolPatchOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolPatchParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolPatchParameter.java new file mode 100644 index 000000000000..5c6ec9928ec3 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolPatchParameter.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of changes to be made to a pool. + */ +public class PoolPatchParameter { + /** + * A task to run on each compute node as it joins the pool. The task runs + * when the node is added to the pool or when the node is restarted. + * If this element is present, it overwrites any existing start task. If + * omitted, any existing start task is left unchanged. + */ + @JsonProperty(value = "startTask") + private StartTask startTask; + + /** + * A list of certificates to be installed on each compute node in the pool. + * If this element is present, it replaces any existing certificate + * references configured on the pool. If omitted, any existing certificate + * references are left unchanged. For Windows compute nodes, the Batch + * service installs the certificates to the specified certificate store and + * location. For Linux compute nodes, the certificates are stored in a + * directory inside the task working directory and an environment variable + * AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this + * location. For certificates with visibility of 'remoteUser', a 'certs' + * directory is created in the user's home directory (e.g., + * /home/{user-name}/certs) and certificates are placed in that directory. + */ + @JsonProperty(value = "certificateReferences") + private List certificateReferences; + + /** + * A list of application packages to be installed on each compute node in + * the pool. + * Changes to application package references affect all new compute nodes + * joining the pool, but do not affect compute nodes that are already in + * the pool until they are rebooted or reimaged. If this element is + * present, it replaces any existing application package references. If you + * specify an empty collection, then all application package references are + * removed from the pool. If omitted, any existing application package + * references are left unchanged. + */ + @JsonProperty(value = "applicationPackageReferences") + private List applicationPackageReferences; + + /** + * A list of name-value pairs associated with the pool as metadata. + * If this element is present, it replaces any existing metadata configured + * on the pool. If you specify an empty collection, any metadata is removed + * from the pool. If omitted, any existing metadata is left unchanged. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Get if this element is present, it overwrites any existing start task. If omitted, any existing start task is left unchanged. + * + * @return the startTask value + */ + public StartTask startTask() { + return this.startTask; + } + + /** + * Set if this element is present, it overwrites any existing start task. If omitted, any existing start task is left unchanged. + * + * @param startTask the startTask value to set + * @return the PoolPatchParameter object itself. + */ + public PoolPatchParameter withStartTask(StartTask startTask) { + this.startTask = startTask; + return this; + } + + /** + * Get if this element is present, it replaces any existing certificate references configured on the pool. If omitted, any existing certificate references are left unchanged. For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @return the certificateReferences value + */ + public List certificateReferences() { + return this.certificateReferences; + } + + /** + * Set if this element is present, it replaces any existing certificate references configured on the pool. If omitted, any existing certificate references are left unchanged. For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @param certificateReferences the certificateReferences value to set + * @return the PoolPatchParameter object itself. + */ + public PoolPatchParameter withCertificateReferences(List certificateReferences) { + this.certificateReferences = certificateReferences; + return this; + } + + /** + * Get changes to application package references affect all new compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or reimaged. If this element is present, it replaces any existing application package references. If you specify an empty collection, then all application package references are removed from the pool. If omitted, any existing application package references are left unchanged. + * + * @return the applicationPackageReferences value + */ + public List applicationPackageReferences() { + return this.applicationPackageReferences; + } + + /** + * Set changes to application package references affect all new compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or reimaged. If this element is present, it replaces any existing application package references. If you specify an empty collection, then all application package references are removed from the pool. If omitted, any existing application package references are left unchanged. + * + * @param applicationPackageReferences the applicationPackageReferences value to set + * @return the PoolPatchParameter object itself. + */ + public PoolPatchParameter withApplicationPackageReferences(List applicationPackageReferences) { + this.applicationPackageReferences = applicationPackageReferences; + return this; + } + + /** + * Get if this element is present, it replaces any existing metadata configured on the pool. If you specify an empty collection, any metadata is removed from the pool. If omitted, any existing metadata is left unchanged. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set if this element is present, it replaces any existing metadata configured on the pool. If you specify an empty collection, any metadata is removed from the pool. If omitted, any existing metadata is left unchanged. + * + * @param metadata the metadata value to set + * @return the PoolPatchParameter object itself. + */ + public PoolPatchParameter withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolRemoveNodesHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolRemoveNodesHeaders.java new file mode 100644 index 000000000000..37fdb991dc9c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolRemoveNodesHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for RemoveNodes operation. + */ +public class PoolRemoveNodesHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolRemoveNodesHeaders object itself. + */ + public PoolRemoveNodesHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolRemoveNodesHeaders object itself. + */ + public PoolRemoveNodesHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolRemoveNodesHeaders object itself. + */ + public PoolRemoveNodesHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolRemoveNodesHeaders object itself. + */ + public PoolRemoveNodesHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the PoolRemoveNodesHeaders object itself. + */ + public PoolRemoveNodesHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolRemoveNodesOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolRemoveNodesOptions.java new file mode 100644 index 000000000000..fdea1f1dc41c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolRemoveNodesOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for removeNodes operation. + */ +public class PoolRemoveNodesOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolRemoveNodesOptions object itself. + */ + public PoolRemoveNodesOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolRemoveNodesOptions object itself. + */ + public PoolRemoveNodesOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolRemoveNodesOptions object itself. + */ + public PoolRemoveNodesOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolRemoveNodesOptions object itself. + */ + public PoolRemoveNodesOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the PoolRemoveNodesOptions object itself. + */ + public PoolRemoveNodesOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the PoolRemoveNodesOptions object itself. + */ + public PoolRemoveNodesOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the PoolRemoveNodesOptions object itself. + */ + public PoolRemoveNodesOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the PoolRemoveNodesOptions object itself. + */ + public PoolRemoveNodesOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolResizeHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolResizeHeaders.java new file mode 100644 index 000000000000..d701c3de52e1 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolResizeHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Resize operation. + */ +public class PoolResizeHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolResizeHeaders object itself. + */ + public PoolResizeHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolResizeHeaders object itself. + */ + public PoolResizeHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolResizeHeaders object itself. + */ + public PoolResizeHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolResizeHeaders object itself. + */ + public PoolResizeHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the PoolResizeHeaders object itself. + */ + public PoolResizeHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolResizeOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolResizeOptions.java new file mode 100644 index 000000000000..5adbf19a3f66 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolResizeOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for resize operation. + */ +public class PoolResizeOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolResizeOptions object itself. + */ + public PoolResizeOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolResizeOptions object itself. + */ + public PoolResizeOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolResizeOptions object itself. + */ + public PoolResizeOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolResizeOptions object itself. + */ + public PoolResizeOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the PoolResizeOptions object itself. + */ + public PoolResizeOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the PoolResizeOptions object itself. + */ + public PoolResizeOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the PoolResizeOptions object itself. + */ + public PoolResizeOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the PoolResizeOptions object itself. + */ + public PoolResizeOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolResizeParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolResizeParameter.java new file mode 100644 index 000000000000..c7e4f186e30f --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolResizeParameter.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Options for changing the size of a pool. + */ +public class PoolResizeParameter { + /** + * The desired number of dedicated compute nodes in the pool. + */ + @JsonProperty(value = "targetDedicatedNodes") + private Integer targetDedicatedNodes; + + /** + * The desired number of low-priority compute nodes in the pool. + */ + @JsonProperty(value = "targetLowPriorityNodes") + private Integer targetLowPriorityNodes; + + /** + * The timeout for allocation of compute nodes to the pool or removal of + * compute nodes from the pool. + * The default value is 15 minutes. The minimum value is 5 minutes. If you + * specify a value less than 5 minutes, the Batch service returns an error; + * if you are calling the REST API directly, the HTTP status code is 400 + * (Bad Request). + */ + @JsonProperty(value = "resizeTimeout") + private Period resizeTimeout; + + /** + * Determines what to do with a node and its running task(s) if the pool + * size is decreasing. + * The default value is requeue. Possible values include: 'requeue', + * 'terminate', 'taskCompletion', 'retainedData'. + */ + @JsonProperty(value = "nodeDeallocationOption") + private ComputeNodeDeallocationOption nodeDeallocationOption; + + /** + * Get the targetDedicatedNodes value. + * + * @return the targetDedicatedNodes value + */ + public Integer targetDedicatedNodes() { + return this.targetDedicatedNodes; + } + + /** + * Set the targetDedicatedNodes value. + * + * @param targetDedicatedNodes the targetDedicatedNodes value to set + * @return the PoolResizeParameter object itself. + */ + public PoolResizeParameter withTargetDedicatedNodes(Integer targetDedicatedNodes) { + this.targetDedicatedNodes = targetDedicatedNodes; + return this; + } + + /** + * Get the targetLowPriorityNodes value. + * + * @return the targetLowPriorityNodes value + */ + public Integer targetLowPriorityNodes() { + return this.targetLowPriorityNodes; + } + + /** + * Set the targetLowPriorityNodes value. + * + * @param targetLowPriorityNodes the targetLowPriorityNodes value to set + * @return the PoolResizeParameter object itself. + */ + public PoolResizeParameter withTargetLowPriorityNodes(Integer targetLowPriorityNodes) { + this.targetLowPriorityNodes = targetLowPriorityNodes; + return this; + } + + /** + * Get the default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @return the resizeTimeout value + */ + public Period resizeTimeout() { + return this.resizeTimeout; + } + + /** + * Set the default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @param resizeTimeout the resizeTimeout value to set + * @return the PoolResizeParameter object itself. + */ + public PoolResizeParameter withResizeTimeout(Period resizeTimeout) { + this.resizeTimeout = resizeTimeout; + return this; + } + + /** + * Get the default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData'. + * + * @return the nodeDeallocationOption value + */ + public ComputeNodeDeallocationOption nodeDeallocationOption() { + return this.nodeDeallocationOption; + } + + /** + * Set the default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData'. + * + * @param nodeDeallocationOption the nodeDeallocationOption value to set + * @return the PoolResizeParameter object itself. + */ + public PoolResizeParameter withNodeDeallocationOption(ComputeNodeDeallocationOption nodeDeallocationOption) { + this.nodeDeallocationOption = nodeDeallocationOption; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolSpecification.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolSpecification.java new file mode 100644 index 000000000000..ecd7f48a5729 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolSpecification.java @@ -0,0 +1,602 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.Period; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specification for creating a new pool. + */ +public class PoolSpecification { + /** + * The display name for the pool. + * The display name need not be unique and can contain any Unicode + * characters up to a maximum length of 1024. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The size of the virtual machines in the pool. All virtual machines in a + * pool are the same size. + * For information about available sizes of virtual machines in pools, see + * Choose a VM size for compute nodes in an Azure Batch pool + * (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + */ + @JsonProperty(value = "vmSize", required = true) + private String vmSize; + + /** + * The cloud service configuration for the pool. + * This property must be specified if the pool needs to be created with + * Azure PaaS VMs. This property and virtualMachineConfiguration are + * mutually exclusive and one of the properties must be specified. If + * neither is specified then the Batch service returns an error; if you are + * calling the REST API directly, the HTTP status code is 400 (Bad + * Request). This property cannot be specified if the Batch account was + * created with its poolAllocationMode property set to 'UserSubscription'. + */ + @JsonProperty(value = "cloudServiceConfiguration") + private CloudServiceConfiguration cloudServiceConfiguration; + + /** + * The virtual machine configuration for the pool. + * This property must be specified if the pool needs to be created with + * Azure IaaS VMs. This property and cloudServiceConfiguration are mutually + * exclusive and one of the properties must be specified. If neither is + * specified then the Batch service returns an error; if you are calling + * the REST API directly, the HTTP status code is 400 (Bad Request). + */ + @JsonProperty(value = "virtualMachineConfiguration") + private VirtualMachineConfiguration virtualMachineConfiguration; + + /** + * The maximum number of tasks that can run concurrently on a single + * compute node in the pool. + * The default value is 1. The maximum value of this setting depends on the + * size of the compute nodes in the pool (the vmSize setting). + */ + @JsonProperty(value = "maxTasksPerNode") + private Integer maxTasksPerNode; + + /** + * How tasks are distributed across compute nodes in a pool. + */ + @JsonProperty(value = "taskSchedulingPolicy") + private TaskSchedulingPolicy taskSchedulingPolicy; + + /** + * The timeout for allocation of compute nodes to the pool. + * This timeout applies only to manual scaling; it has no effect when + * enableAutoScale is set to true. The default value is 15 minutes. The + * minimum value is 5 minutes. If you specify a value less than 5 minutes, + * the Batch service rejects the request with an error; if you are calling + * the REST API directly, the HTTP status code is 400 (Bad Request). + */ + @JsonProperty(value = "resizeTimeout") + private Period resizeTimeout; + + /** + * The desired number of dedicated compute nodes in the pool. + * This property must not be specified if enableAutoScale is set to true. + * If enableAutoScale is set to false, then you must set either + * targetDedicatedNodes, targetLowPriorityNodes, or both. + */ + @JsonProperty(value = "targetDedicatedNodes") + private Integer targetDedicatedNodes; + + /** + * The desired number of low-priority compute nodes in the pool. + * This property must not be specified if enableAutoScale is set to true. + * If enableAutoScale is set to false, then you must set either + * targetDedicatedNodes, targetLowPriorityNodes, or both. + */ + @JsonProperty(value = "targetLowPriorityNodes") + private Integer targetLowPriorityNodes; + + /** + * Whether the pool size should automatically adjust over time. + * If false, at least one of targetDedicateNodes and targetLowPriorityNodes + * must be specified. If true, the autoScaleFormula element is required. + * The pool automatically resizes according to the formula. The default + * value is false. + */ + @JsonProperty(value = "enableAutoScale") + private Boolean enableAutoScale; + + /** + * The formula for the desired number of compute nodes in the pool. + * This property must not be specified if enableAutoScale is set to false. + * It is required if enableAutoScale is set to true. The formula is checked + * for validity before the pool is created. If the formula is not valid, + * the Batch service rejects the request with detailed error information. + */ + @JsonProperty(value = "autoScaleFormula") + private String autoScaleFormula; + + /** + * The time interval at which to automatically adjust the pool size + * according to the autoscale formula. + * The default value is 15 minutes. The minimum and maximum value are 5 + * minutes and 168 hours respectively. If you specify a value less than 5 + * minutes or greater than 168 hours, the Batch service rejects the request + * with an invalid property value error; if you are calling the REST API + * directly, the HTTP status code is 400 (Bad Request). + */ + @JsonProperty(value = "autoScaleEvaluationInterval") + private Period autoScaleEvaluationInterval; + + /** + * Whether the pool permits direct communication between nodes. + * Enabling inter-node communication limits the maximum size of the pool + * due to deployment restrictions on the nodes of the pool. This may result + * in the pool not reaching its desired size. The default value is false. + */ + @JsonProperty(value = "enableInterNodeCommunication") + private Boolean enableInterNodeCommunication; + + /** + * The network configuration for the pool. + */ + @JsonProperty(value = "networkConfiguration") + private NetworkConfiguration networkConfiguration; + + /** + * A task to run on each compute node as it joins the pool. The task runs + * when the node is added to the pool or when the node is restarted. + */ + @JsonProperty(value = "startTask") + private StartTask startTask; + + /** + * A list of certificates to be installed on each compute node in the pool. + * For Windows compute nodes, the Batch service installs the certificates + * to the specified certificate store and location. For Linux compute + * nodes, the certificates are stored in a directory inside the task + * working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR + * is supplied to the task to query for this location. For certificates + * with visibility of 'remoteUser', a 'certs' directory is created in the + * user's home directory (e.g., /home/{user-name}/certs) and certificates + * are placed in that directory. + */ + @JsonProperty(value = "certificateReferences") + private List certificateReferences; + + /** + * The list of application packages to be installed on each compute node in + * the pool. + */ + @JsonProperty(value = "applicationPackageReferences") + private List applicationPackageReferences; + + /** + * The list of application licenses the Batch service will make available + * on each compute node in the pool. + * The list of application licenses must be a subset of available Batch + * service application licenses. If a license is requested which is not + * supported, pool creation will fail. The permitted licenses available on + * the pool are 'maya', 'vray', '3dsmax', 'arnold'. An additional charge + * applies for each application license added to the pool. + */ + @JsonProperty(value = "applicationLicenses") + private List applicationLicenses; + + /** + * The list of user accounts to be created on each node in the pool. + */ + @JsonProperty(value = "userAccounts") + private List userAccounts; + + /** + * A list of name-value pairs associated with the pool as metadata. + * The Batch service does not assign any meaning to metadata; it is solely + * for the use of user code. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Get the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @param displayName the displayName value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get for information about available sizes of virtual machines in pools, see Choose a VM size for compute nodes in an Azure Batch pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + * + * @return the vmSize value + */ + public String vmSize() { + return this.vmSize; + } + + /** + * Set for information about available sizes of virtual machines in pools, see Choose a VM size for compute nodes in an Azure Batch pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + * + * @param vmSize the vmSize value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withVmSize(String vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get this property must be specified if the pool needs to be created with Azure PaaS VMs. This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. If neither is specified then the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. + * + * @return the cloudServiceConfiguration value + */ + public CloudServiceConfiguration cloudServiceConfiguration() { + return this.cloudServiceConfiguration; + } + + /** + * Set this property must be specified if the pool needs to be created with Azure PaaS VMs. This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. If neither is specified then the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. + * + * @param cloudServiceConfiguration the cloudServiceConfiguration value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withCloudServiceConfiguration(CloudServiceConfiguration cloudServiceConfiguration) { + this.cloudServiceConfiguration = cloudServiceConfiguration; + return this; + } + + /** + * Get this property must be specified if the pool needs to be created with Azure IaaS VMs. This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. If neither is specified then the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @return the virtualMachineConfiguration value + */ + public VirtualMachineConfiguration virtualMachineConfiguration() { + return this.virtualMachineConfiguration; + } + + /** + * Set this property must be specified if the pool needs to be created with Azure IaaS VMs. This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. If neither is specified then the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @param virtualMachineConfiguration the virtualMachineConfiguration value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withVirtualMachineConfiguration(VirtualMachineConfiguration virtualMachineConfiguration) { + this.virtualMachineConfiguration = virtualMachineConfiguration; + return this; + } + + /** + * Get the default value is 1. The maximum value of this setting depends on the size of the compute nodes in the pool (the vmSize setting). + * + * @return the maxTasksPerNode value + */ + public Integer maxTasksPerNode() { + return this.maxTasksPerNode; + } + + /** + * Set the default value is 1. The maximum value of this setting depends on the size of the compute nodes in the pool (the vmSize setting). + * + * @param maxTasksPerNode the maxTasksPerNode value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withMaxTasksPerNode(Integer maxTasksPerNode) { + this.maxTasksPerNode = maxTasksPerNode; + return this; + } + + /** + * Get the taskSchedulingPolicy value. + * + * @return the taskSchedulingPolicy value + */ + public TaskSchedulingPolicy taskSchedulingPolicy() { + return this.taskSchedulingPolicy; + } + + /** + * Set the taskSchedulingPolicy value. + * + * @param taskSchedulingPolicy the taskSchedulingPolicy value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withTaskSchedulingPolicy(TaskSchedulingPolicy taskSchedulingPolicy) { + this.taskSchedulingPolicy = taskSchedulingPolicy; + return this; + } + + /** + * Get this timeout applies only to manual scaling; it has no effect when enableAutoScale is set to true. The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @return the resizeTimeout value + */ + public Period resizeTimeout() { + return this.resizeTimeout; + } + + /** + * Set this timeout applies only to manual scaling; it has no effect when enableAutoScale is set to true. The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @param resizeTimeout the resizeTimeout value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withResizeTimeout(Period resizeTimeout) { + this.resizeTimeout = resizeTimeout; + return this; + } + + /** + * Get this property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + * + * @return the targetDedicatedNodes value + */ + public Integer targetDedicatedNodes() { + return this.targetDedicatedNodes; + } + + /** + * Set this property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + * + * @param targetDedicatedNodes the targetDedicatedNodes value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withTargetDedicatedNodes(Integer targetDedicatedNodes) { + this.targetDedicatedNodes = targetDedicatedNodes; + return this; + } + + /** + * Get this property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + * + * @return the targetLowPriorityNodes value + */ + public Integer targetLowPriorityNodes() { + return this.targetLowPriorityNodes; + } + + /** + * Set this property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + * + * @param targetLowPriorityNodes the targetLowPriorityNodes value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withTargetLowPriorityNodes(Integer targetLowPriorityNodes) { + this.targetLowPriorityNodes = targetLowPriorityNodes; + return this; + } + + /** + * Get if false, at least one of targetDedicateNodes and targetLowPriorityNodes must be specified. If true, the autoScaleFormula element is required. The pool automatically resizes according to the formula. The default value is false. + * + * @return the enableAutoScale value + */ + public Boolean enableAutoScale() { + return this.enableAutoScale; + } + + /** + * Set if false, at least one of targetDedicateNodes and targetLowPriorityNodes must be specified. If true, the autoScaleFormula element is required. The pool automatically resizes according to the formula. The default value is false. + * + * @param enableAutoScale the enableAutoScale value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withEnableAutoScale(Boolean enableAutoScale) { + this.enableAutoScale = enableAutoScale; + return this; + } + + /** + * Get this property must not be specified if enableAutoScale is set to false. It is required if enableAutoScale is set to true. The formula is checked for validity before the pool is created. If the formula is not valid, the Batch service rejects the request with detailed error information. + * + * @return the autoScaleFormula value + */ + public String autoScaleFormula() { + return this.autoScaleFormula; + } + + /** + * Set this property must not be specified if enableAutoScale is set to false. It is required if enableAutoScale is set to true. The formula is checked for validity before the pool is created. If the formula is not valid, the Batch service rejects the request with detailed error information. + * + * @param autoScaleFormula the autoScaleFormula value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withAutoScaleFormula(String autoScaleFormula) { + this.autoScaleFormula = autoScaleFormula; + return this; + } + + /** + * Get the default value is 15 minutes. The minimum and maximum value are 5 minutes and 168 hours respectively. If you specify a value less than 5 minutes or greater than 168 hours, the Batch service rejects the request with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @return the autoScaleEvaluationInterval value + */ + public Period autoScaleEvaluationInterval() { + return this.autoScaleEvaluationInterval; + } + + /** + * Set the default value is 15 minutes. The minimum and maximum value are 5 minutes and 168 hours respectively. If you specify a value less than 5 minutes or greater than 168 hours, the Batch service rejects the request with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @param autoScaleEvaluationInterval the autoScaleEvaluationInterval value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withAutoScaleEvaluationInterval(Period autoScaleEvaluationInterval) { + this.autoScaleEvaluationInterval = autoScaleEvaluationInterval; + return this; + } + + /** + * Get enabling inter-node communication limits the maximum size of the pool due to deployment restrictions on the nodes of the pool. This may result in the pool not reaching its desired size. The default value is false. + * + * @return the enableInterNodeCommunication value + */ + public Boolean enableInterNodeCommunication() { + return this.enableInterNodeCommunication; + } + + /** + * Set enabling inter-node communication limits the maximum size of the pool due to deployment restrictions on the nodes of the pool. This may result in the pool not reaching its desired size. The default value is false. + * + * @param enableInterNodeCommunication the enableInterNodeCommunication value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withEnableInterNodeCommunication(Boolean enableInterNodeCommunication) { + this.enableInterNodeCommunication = enableInterNodeCommunication; + return this; + } + + /** + * Get the networkConfiguration value. + * + * @return the networkConfiguration value + */ + public NetworkConfiguration networkConfiguration() { + return this.networkConfiguration; + } + + /** + * Set the networkConfiguration value. + * + * @param networkConfiguration the networkConfiguration value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withNetworkConfiguration(NetworkConfiguration networkConfiguration) { + this.networkConfiguration = networkConfiguration; + return this; + } + + /** + * Get the startTask value. + * + * @return the startTask value + */ + public StartTask startTask() { + return this.startTask; + } + + /** + * Set the startTask value. + * + * @param startTask the startTask value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withStartTask(StartTask startTask) { + this.startTask = startTask; + return this; + } + + /** + * Get for Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @return the certificateReferences value + */ + public List certificateReferences() { + return this.certificateReferences; + } + + /** + * Set for Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @param certificateReferences the certificateReferences value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withCertificateReferences(List certificateReferences) { + this.certificateReferences = certificateReferences; + return this; + } + + /** + * Get the applicationPackageReferences value. + * + * @return the applicationPackageReferences value + */ + public List applicationPackageReferences() { + return this.applicationPackageReferences; + } + + /** + * Set the applicationPackageReferences value. + * + * @param applicationPackageReferences the applicationPackageReferences value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withApplicationPackageReferences(List applicationPackageReferences) { + this.applicationPackageReferences = applicationPackageReferences; + return this; + } + + /** + * Get the list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. The permitted licenses available on the pool are 'maya', 'vray', '3dsmax', 'arnold'. An additional charge applies for each application license added to the pool. + * + * @return the applicationLicenses value + */ + public List applicationLicenses() { + return this.applicationLicenses; + } + + /** + * Set the list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. The permitted licenses available on the pool are 'maya', 'vray', '3dsmax', 'arnold'. An additional charge applies for each application license added to the pool. + * + * @param applicationLicenses the applicationLicenses value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withApplicationLicenses(List applicationLicenses) { + this.applicationLicenses = applicationLicenses; + return this; + } + + /** + * Get the userAccounts value. + * + * @return the userAccounts value + */ + public List userAccounts() { + return this.userAccounts; + } + + /** + * Set the userAccounts value. + * + * @param userAccounts the userAccounts value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withUserAccounts(List userAccounts) { + this.userAccounts = userAccounts; + return this; + } + + /** + * Get the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the Batch service does not assign any meaning to metadata; it is solely for the use of user code. + * + * @param metadata the metadata value to set + * @return the PoolSpecification object itself. + */ + public PoolSpecification withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolState.java new file mode 100644 index 000000000000..13a6b96ee2ed --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolState.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PoolState. + */ +public enum PoolState { + /** The pool is available to run tasks subject to the availability of compute nodes. */ + ACTIVE("active"), + + /** The user has requested that the pool be deleted, but the delete operation has not yet completed. */ + DELETING("deleting"); + + /** The actual serialized value for a PoolState instance. */ + private String value; + + PoolState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PoolState instance. + * + * @param value the serialized value to parse. + * @return the parsed PoolState object, or null if unable to parse. + */ + @JsonCreator + public static PoolState fromString(String value) { + PoolState[] items = PoolState.values(); + for (PoolState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolStatistics.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolStatistics.java new file mode 100644 index 000000000000..1c1d8c95fb9a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolStatistics.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains utilization and resource usage statistics for the lifetime of a + * pool. + */ +public class PoolStatistics { + /** + * The URL for the statistics. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * The start time of the time range covered by the statistics. + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The time at which the statistics were last updated. All statistics are + * limited to the range between startTime and lastUpdateTime. + */ + @JsonProperty(value = "lastUpdateTime", required = true) + private DateTime lastUpdateTime; + + /** + * Statistics related to pool usage, such as the amount of core-time used. + */ + @JsonProperty(value = "usageStats") + private UsageStatistics usageStats; + + /** + * Statistics related to resource consumption by compute nodes in the pool. + */ + @JsonProperty(value = "resourceStats") + private ResourceStatistics resourceStats; + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the PoolStatistics object itself. + */ + public PoolStatistics withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime value. + * + * @param startTime the startTime value to set + * @return the PoolStatistics object itself. + */ + public PoolStatistics withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the lastUpdateTime value. + * + * @return the lastUpdateTime value + */ + public DateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime value. + * + * @param lastUpdateTime the lastUpdateTime value to set + * @return the PoolStatistics object itself. + */ + public PoolStatistics withLastUpdateTime(DateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the usageStats value. + * + * @return the usageStats value + */ + public UsageStatistics usageStats() { + return this.usageStats; + } + + /** + * Set the usageStats value. + * + * @param usageStats the usageStats value to set + * @return the PoolStatistics object itself. + */ + public PoolStatistics withUsageStats(UsageStatistics usageStats) { + this.usageStats = usageStats; + return this; + } + + /** + * Get the resourceStats value. + * + * @return the resourceStats value + */ + public ResourceStatistics resourceStats() { + return this.resourceStats; + } + + /** + * Set the resourceStats value. + * + * @param resourceStats the resourceStats value to set + * @return the PoolStatistics object itself. + */ + public PoolStatistics withResourceStats(ResourceStatistics resourceStats) { + this.resourceStats = resourceStats; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolStopResizeHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolStopResizeHeaders.java new file mode 100644 index 000000000000..09dd56f8d189 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolStopResizeHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for StopResize operation. + */ +public class PoolStopResizeHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolStopResizeHeaders object itself. + */ + public PoolStopResizeHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolStopResizeHeaders object itself. + */ + public PoolStopResizeHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolStopResizeHeaders object itself. + */ + public PoolStopResizeHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolStopResizeHeaders object itself. + */ + public PoolStopResizeHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the PoolStopResizeHeaders object itself. + */ + public PoolStopResizeHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolStopResizeOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolStopResizeOptions.java new file mode 100644 index 000000000000..0c46b2cf5bef --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolStopResizeOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for stopResize operation. + */ +public class PoolStopResizeOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolStopResizeOptions object itself. + */ + public PoolStopResizeOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolStopResizeOptions object itself. + */ + public PoolStopResizeOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolStopResizeOptions object itself. + */ + public PoolStopResizeOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolStopResizeOptions object itself. + */ + public PoolStopResizeOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the PoolStopResizeOptions object itself. + */ + public PoolStopResizeOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the PoolStopResizeOptions object itself. + */ + public PoolStopResizeOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the PoolStopResizeOptions object itself. + */ + public PoolStopResizeOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the PoolStopResizeOptions object itself. + */ + public PoolStopResizeOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUpdatePropertiesHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUpdatePropertiesHeaders.java new file mode 100644 index 000000000000..7fbd22877e93 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUpdatePropertiesHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for UpdateProperties operation. + */ +public class PoolUpdatePropertiesHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolUpdatePropertiesHeaders object itself. + */ + public PoolUpdatePropertiesHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the PoolUpdatePropertiesHeaders object itself. + */ + public PoolUpdatePropertiesHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the PoolUpdatePropertiesHeaders object itself. + */ + public PoolUpdatePropertiesHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the PoolUpdatePropertiesHeaders object itself. + */ + public PoolUpdatePropertiesHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the PoolUpdatePropertiesHeaders object itself. + */ + public PoolUpdatePropertiesHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUpdatePropertiesOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUpdatePropertiesOptions.java new file mode 100644 index 000000000000..addc4eec0066 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUpdatePropertiesOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for updateProperties operation. + */ +public class PoolUpdatePropertiesOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the PoolUpdatePropertiesOptions object itself. + */ + public PoolUpdatePropertiesOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the PoolUpdatePropertiesOptions object itself. + */ + public PoolUpdatePropertiesOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the PoolUpdatePropertiesOptions object itself. + */ + public PoolUpdatePropertiesOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the PoolUpdatePropertiesOptions object itself. + */ + public PoolUpdatePropertiesOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUpdatePropertiesParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUpdatePropertiesParameter.java new file mode 100644 index 000000000000..3b8de661c4fb --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUpdatePropertiesParameter.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of changes to be made to a pool. + */ +public class PoolUpdatePropertiesParameter { + /** + * A task to run on each compute node as it joins the pool. The task runs + * when the node is added to the pool or when the node is restarted. + * If this element is present, it overwrites any existing start task. If + * omitted, any existing start task is removed from the pool. + */ + @JsonProperty(value = "startTask") + private StartTask startTask; + + /** + * A list of certificates to be installed on each compute node in the pool. + * This list replaces any existing certificate references configured on the + * pool. If you specify an empty collection, any existing certificate + * references are removed from the pool. For Windows compute nodes, the + * Batch service installs the certificates to the specified certificate + * store and location. For Linux compute nodes, the certificates are stored + * in a directory inside the task working directory and an environment + * variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for + * this location. For certificates with visibility of 'remoteUser', a + * 'certs' directory is created in the user's home directory (e.g., + * /home/{user-name}/certs) and certificates are placed in that directory. + */ + @JsonProperty(value = "certificateReferences", required = true) + private List certificateReferences; + + /** + * A list of application packages to be installed on each compute node in + * the pool. + * The list replaces any existing application package references on the + * pool. Changes to application package references affect all new compute + * nodes joining the pool, but do not affect compute nodes that are already + * in the pool until they are rebooted or reimaged. If omitted, or if you + * specify an empty collection, any existing application packages + * references are removed from the pool. + */ + @JsonProperty(value = "applicationPackageReferences", required = true) + private List applicationPackageReferences; + + /** + * A list of name-value pairs associated with the pool as metadata. + * This list replaces any existing metadata configured on the pool. If + * omitted, or if you specify an empty collection, any existing metadata is + * removed from the pool. + */ + @JsonProperty(value = "metadata", required = true) + private List metadata; + + /** + * Get if this element is present, it overwrites any existing start task. If omitted, any existing start task is removed from the pool. + * + * @return the startTask value + */ + public StartTask startTask() { + return this.startTask; + } + + /** + * Set if this element is present, it overwrites any existing start task. If omitted, any existing start task is removed from the pool. + * + * @param startTask the startTask value to set + * @return the PoolUpdatePropertiesParameter object itself. + */ + public PoolUpdatePropertiesParameter withStartTask(StartTask startTask) { + this.startTask = startTask; + return this; + } + + /** + * Get this list replaces any existing certificate references configured on the pool. If you specify an empty collection, any existing certificate references are removed from the pool. For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @return the certificateReferences value + */ + public List certificateReferences() { + return this.certificateReferences; + } + + /** + * Set this list replaces any existing certificate references configured on the pool. If you specify an empty collection, any existing certificate references are removed from the pool. For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @param certificateReferences the certificateReferences value to set + * @return the PoolUpdatePropertiesParameter object itself. + */ + public PoolUpdatePropertiesParameter withCertificateReferences(List certificateReferences) { + this.certificateReferences = certificateReferences; + return this; + } + + /** + * Get the list replaces any existing application package references on the pool. Changes to application package references affect all new compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or reimaged. If omitted, or if you specify an empty collection, any existing application packages references are removed from the pool. + * + * @return the applicationPackageReferences value + */ + public List applicationPackageReferences() { + return this.applicationPackageReferences; + } + + /** + * Set the list replaces any existing application package references on the pool. Changes to application package references affect all new compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or reimaged. If omitted, or if you specify an empty collection, any existing application packages references are removed from the pool. + * + * @param applicationPackageReferences the applicationPackageReferences value to set + * @return the PoolUpdatePropertiesParameter object itself. + */ + public PoolUpdatePropertiesParameter withApplicationPackageReferences(List applicationPackageReferences) { + this.applicationPackageReferences = applicationPackageReferences; + return this; + } + + /** + * Get this list replaces any existing metadata configured on the pool. If omitted, or if you specify an empty collection, any existing metadata is removed from the pool. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set this list replaces any existing metadata configured on the pool. If omitted, or if you specify an empty collection, any existing metadata is removed from the pool. + * + * @param metadata the metadata value to set + * @return the PoolUpdatePropertiesParameter object itself. + */ + public PoolUpdatePropertiesParameter withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUsageMetrics.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUsageMetrics.java new file mode 100644 index 000000000000..a4933505769a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/PoolUsageMetrics.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Usage metrics for a pool across an aggregation interval. + */ +public class PoolUsageMetrics { + /** + * The ID of the pool whose metrics are aggregated in this entry. + */ + @JsonProperty(value = "poolId", required = true) + private String poolId; + + /** + * The start time of the aggregation interval covered by this entry. + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The end time of the aggregation interval covered by this entry. + */ + @JsonProperty(value = "endTime", required = true) + private DateTime endTime; + + /** + * The size of virtual machines in the pool. All VMs in a pool are the same + * size. + * For information about available sizes of virtual machines in pools, see + * Choose a VM size for compute nodes in an Azure Batch pool + * (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + */ + @JsonProperty(value = "vmSize", required = true) + private String vmSize; + + /** + * The total core hours used in the pool during this aggregation interval. + */ + @JsonProperty(value = "totalCoreHours", required = true) + private double totalCoreHours; + + /** + * Get the poolId value. + * + * @return the poolId value + */ + public String poolId() { + return this.poolId; + } + + /** + * Set the poolId value. + * + * @param poolId the poolId value to set + * @return the PoolUsageMetrics object itself. + */ + public PoolUsageMetrics withPoolId(String poolId) { + this.poolId = poolId; + return this; + } + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime value. + * + * @param startTime the startTime value to set + * @return the PoolUsageMetrics object itself. + */ + public PoolUsageMetrics withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime value. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime value. + * + * @param endTime the endTime value to set + * @return the PoolUsageMetrics object itself. + */ + public PoolUsageMetrics withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get for information about available sizes of virtual machines in pools, see Choose a VM size for compute nodes in an Azure Batch pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + * + * @return the vmSize value + */ + public String vmSize() { + return this.vmSize; + } + + /** + * Set for information about available sizes of virtual machines in pools, see Choose a VM size for compute nodes in an Azure Batch pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + * + * @param vmSize the vmSize value to set + * @return the PoolUsageMetrics object itself. + */ + public PoolUsageMetrics withVmSize(String vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get the totalCoreHours value. + * + * @return the totalCoreHours value + */ + public double totalCoreHours() { + return this.totalCoreHours; + } + + /** + * Set the totalCoreHours value. + * + * @param totalCoreHours the totalCoreHours value to set + * @return the PoolUsageMetrics object itself. + */ + public PoolUsageMetrics withTotalCoreHours(double totalCoreHours) { + this.totalCoreHours = totalCoreHours; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/RecentJob.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/RecentJob.java new file mode 100644 index 000000000000..b5906bf49120 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/RecentJob.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about the most recent job to run under the job schedule. + */ +public class RecentJob { + /** + * The ID of the job. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The URL of the job. + */ + @JsonProperty(value = "url") + private String url; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the RecentJob object itself. + */ + public RecentJob withId(String id) { + this.id = id; + return this; + } + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the RecentJob object itself. + */ + public RecentJob withUrl(String url) { + this.url = url; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ResizeError.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ResizeError.java new file mode 100644 index 000000000000..3df7dff32e89 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ResizeError.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error that occurred when resizing a pool. + */ +public class ResizeError { + /** + * An identifier for the pool resize error. Codes are invariant and are + * intended to be consumed programmatically. + */ + @JsonProperty(value = "code") + private String code; + + /** + * A message describing the pool resize error, intended to be suitable for + * display in a user interface. + */ + @JsonProperty(value = "message") + private String message; + + /** + * A list of additional error details related to the pool resize error. + */ + @JsonProperty(value = "values") + private List values; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the ResizeError object itself. + */ + public ResizeError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the ResizeError object itself. + */ + public ResizeError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the values value. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set the values value. + * + * @param values the values value to set + * @return the ResizeError object itself. + */ + public ResizeError withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ResourceFile.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ResourceFile.java new file mode 100644 index 000000000000..18d598022c6a --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ResourceFile.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A single file or multiple files to be downloaded to a compute node. + */ +public class ResourceFile { + /** + * The storage container name in the auto storage account. + * The autoStorageContainerName, storageContainerUrl and httpUrl properties + * are mutually exclusive and one of them must be specified. + */ + @JsonProperty(value = "autoStorageContainerName") + private String autoStorageContainerName; + + /** + * The URL of the blob container within Azure Blob Storage. + * The autoStorageContainerName, storageContainerUrl and httpUrl properties + * are mutually exclusive and one of them must be specified. This URL must + * be readable and listable using anonymous access; that is, the Batch + * service does not present any credentials when downloading blobs from the + * container. There are two ways to get such a URL for a container in Azure + * storage: include a Shared Access Signature (SAS) granting read + * permissions on the container, or set the ACL for the container to allow + * public access. + */ + @JsonProperty(value = "storageContainerUrl") + private String storageContainerUrl; + + /** + * The URL of the file to download. + * The autoStorageContainerName, storageContainerUrl and httpUrl properties + * are mutually exclusive and one of them must be specified. If the URL + * points to Azure Blob Storage, it must be readable using anonymous + * access; that is, the Batch service does not present any credentials when + * downloading the blob. There are two ways to get such a URL for a blob in + * Azure storage: include a Shared Access Signature (SAS) granting read + * permissions on the blob, or set the ACL for the blob or its container to + * allow public access. + */ + @JsonProperty(value = "httpUrl") + private String httpUrl; + + /** + * The blob prefix to use when downloading blobs from an Azure Storage + * container. Only the blobs whose names begin with the specified prefix + * will be downloaded. + * The property is valid only when autoStorageContainerName or + * storageContainerUrl is used. This prefix can be a partial filename or a + * subdirectory. If a prefix is not specified, all the files in the + * container will be downloaded. + */ + @JsonProperty(value = "blobPrefix") + private String blobPrefix; + + /** + * The location on the compute node to which to download the file(s), + * relative to the task's working directory. + * If the httpUrl property is specified, the filePath is required and + * describes the path which the file will be downloaded to, including the + * filename. Otherwise, if the autoStorageContainerName or + * storageContainerUrl property is specified, filePath is optional and is + * the directory to download the files to. In the case where filePath is + * used as a directory, any directory structure already associated with the + * input data will be retained in full and appended to the specified + * filePath directory. The specified relative path cannot break out of the + * task's working directory (for example by using '..'). + */ + @JsonProperty(value = "filePath") + private String filePath; + + /** + * The file permission mode attribute in octal format. + * This property applies only to files being downloaded to Linux compute + * nodes. It will be ignored if it is specified for a resourceFile which + * will be downloaded to a Windows node. If this property is not specified + * for a Linux node, then a default value of 0770 is applied to the file. + */ + @JsonProperty(value = "fileMode") + private String fileMode; + + /** + * Get the autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. + * + * @return the autoStorageContainerName value + */ + public String autoStorageContainerName() { + return this.autoStorageContainerName; + } + + /** + * Set the autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. + * + * @param autoStorageContainerName the autoStorageContainerName value to set + * @return the ResourceFile object itself. + */ + public ResourceFile withAutoStorageContainerName(String autoStorageContainerName) { + this.autoStorageContainerName = autoStorageContainerName; + return this; + } + + /** + * Get the autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. This URL must be readable and listable using anonymous access; that is, the Batch service does not present any credentials when downloading blobs from the container. There are two ways to get such a URL for a container in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the container, or set the ACL for the container to allow public access. + * + * @return the storageContainerUrl value + */ + public String storageContainerUrl() { + return this.storageContainerUrl; + } + + /** + * Set the autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. This URL must be readable and listable using anonymous access; that is, the Batch service does not present any credentials when downloading blobs from the container. There are two ways to get such a URL for a container in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the container, or set the ACL for the container to allow public access. + * + * @param storageContainerUrl the storageContainerUrl value to set + * @return the ResourceFile object itself. + */ + public ResourceFile withStorageContainerUrl(String storageContainerUrl) { + this.storageContainerUrl = storageContainerUrl; + return this; + } + + /** + * Get the autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. If the URL points to Azure Blob Storage, it must be readable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access. + * + * @return the httpUrl value + */ + public String httpUrl() { + return this.httpUrl; + } + + /** + * Set the autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. If the URL points to Azure Blob Storage, it must be readable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access. + * + * @param httpUrl the httpUrl value to set + * @return the ResourceFile object itself. + */ + public ResourceFile withHttpUrl(String httpUrl) { + this.httpUrl = httpUrl; + return this; + } + + /** + * Get the property is valid only when autoStorageContainerName or storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded. + * + * @return the blobPrefix value + */ + public String blobPrefix() { + return this.blobPrefix; + } + + /** + * Set the property is valid only when autoStorageContainerName or storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded. + * + * @param blobPrefix the blobPrefix value to set + * @return the ResourceFile object itself. + */ + public ResourceFile withBlobPrefix(String blobPrefix) { + this.blobPrefix = blobPrefix; + return this; + } + + /** + * Get if the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). + * + * @return the filePath value + */ + public String filePath() { + return this.filePath; + } + + /** + * Set if the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). + * + * @param filePath the filePath value to set + * @return the ResourceFile object itself. + */ + public ResourceFile withFilePath(String filePath) { + this.filePath = filePath; + return this; + } + + /** + * Get this property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. + * + * @return the fileMode value + */ + public String fileMode() { + return this.fileMode; + } + + /** + * Set this property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. + * + * @param fileMode the fileMode value to set + * @return the ResourceFile object itself. + */ + public ResourceFile withFileMode(String fileMode) { + this.fileMode = fileMode; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ResourceStatistics.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ResourceStatistics.java new file mode 100644 index 000000000000..c7ca54cb63e5 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/ResourceStatistics.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Statistics related to resource consumption by compute nodes in a pool. + */ +public class ResourceStatistics { + /** + * The start time of the time range covered by the statistics. + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The time at which the statistics were last updated. All statistics are + * limited to the range between startTime and lastUpdateTime. + */ + @JsonProperty(value = "lastUpdateTime", required = true) + private DateTime lastUpdateTime; + + /** + * The average CPU usage across all nodes in the pool (percentage per + * node). + */ + @JsonProperty(value = "avgCPUPercentage", required = true) + private double avgCPUPercentage; + + /** + * The average memory usage in GiB across all nodes in the pool. + */ + @JsonProperty(value = "avgMemoryGiB", required = true) + private double avgMemoryGiB; + + /** + * The peak memory usage in GiB across all nodes in the pool. + */ + @JsonProperty(value = "peakMemoryGiB", required = true) + private double peakMemoryGiB; + + /** + * The average used disk space in GiB across all nodes in the pool. + */ + @JsonProperty(value = "avgDiskGiB", required = true) + private double avgDiskGiB; + + /** + * The peak used disk space in GiB across all nodes in the pool. + */ + @JsonProperty(value = "peakDiskGiB", required = true) + private double peakDiskGiB; + + /** + * The total number of disk read operations across all nodes in the pool. + */ + @JsonProperty(value = "diskReadIOps", required = true) + private long diskReadIOps; + + /** + * The total number of disk write operations across all nodes in the pool. + */ + @JsonProperty(value = "diskWriteIOps", required = true) + private long diskWriteIOps; + + /** + * The total amount of data in GiB of disk reads across all nodes in the + * pool. + */ + @JsonProperty(value = "diskReadGiB", required = true) + private double diskReadGiB; + + /** + * The total amount of data in GiB of disk writes across all nodes in the + * pool. + */ + @JsonProperty(value = "diskWriteGiB", required = true) + private double diskWriteGiB; + + /** + * The total amount of data in GiB of network reads across all nodes in the + * pool. + */ + @JsonProperty(value = "networkReadGiB", required = true) + private double networkReadGiB; + + /** + * The total amount of data in GiB of network writes across all nodes in + * the pool. + */ + @JsonProperty(value = "networkWriteGiB", required = true) + private double networkWriteGiB; + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime value. + * + * @param startTime the startTime value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the lastUpdateTime value. + * + * @return the lastUpdateTime value + */ + public DateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime value. + * + * @param lastUpdateTime the lastUpdateTime value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withLastUpdateTime(DateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the avgCPUPercentage value. + * + * @return the avgCPUPercentage value + */ + public double avgCPUPercentage() { + return this.avgCPUPercentage; + } + + /** + * Set the avgCPUPercentage value. + * + * @param avgCPUPercentage the avgCPUPercentage value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withAvgCPUPercentage(double avgCPUPercentage) { + this.avgCPUPercentage = avgCPUPercentage; + return this; + } + + /** + * Get the avgMemoryGiB value. + * + * @return the avgMemoryGiB value + */ + public double avgMemoryGiB() { + return this.avgMemoryGiB; + } + + /** + * Set the avgMemoryGiB value. + * + * @param avgMemoryGiB the avgMemoryGiB value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withAvgMemoryGiB(double avgMemoryGiB) { + this.avgMemoryGiB = avgMemoryGiB; + return this; + } + + /** + * Get the peakMemoryGiB value. + * + * @return the peakMemoryGiB value + */ + public double peakMemoryGiB() { + return this.peakMemoryGiB; + } + + /** + * Set the peakMemoryGiB value. + * + * @param peakMemoryGiB the peakMemoryGiB value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withPeakMemoryGiB(double peakMemoryGiB) { + this.peakMemoryGiB = peakMemoryGiB; + return this; + } + + /** + * Get the avgDiskGiB value. + * + * @return the avgDiskGiB value + */ + public double avgDiskGiB() { + return this.avgDiskGiB; + } + + /** + * Set the avgDiskGiB value. + * + * @param avgDiskGiB the avgDiskGiB value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withAvgDiskGiB(double avgDiskGiB) { + this.avgDiskGiB = avgDiskGiB; + return this; + } + + /** + * Get the peakDiskGiB value. + * + * @return the peakDiskGiB value + */ + public double peakDiskGiB() { + return this.peakDiskGiB; + } + + /** + * Set the peakDiskGiB value. + * + * @param peakDiskGiB the peakDiskGiB value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withPeakDiskGiB(double peakDiskGiB) { + this.peakDiskGiB = peakDiskGiB; + return this; + } + + /** + * Get the diskReadIOps value. + * + * @return the diskReadIOps value + */ + public long diskReadIOps() { + return this.diskReadIOps; + } + + /** + * Set the diskReadIOps value. + * + * @param diskReadIOps the diskReadIOps value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withDiskReadIOps(long diskReadIOps) { + this.diskReadIOps = diskReadIOps; + return this; + } + + /** + * Get the diskWriteIOps value. + * + * @return the diskWriteIOps value + */ + public long diskWriteIOps() { + return this.diskWriteIOps; + } + + /** + * Set the diskWriteIOps value. + * + * @param diskWriteIOps the diskWriteIOps value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withDiskWriteIOps(long diskWriteIOps) { + this.diskWriteIOps = diskWriteIOps; + return this; + } + + /** + * Get the diskReadGiB value. + * + * @return the diskReadGiB value + */ + public double diskReadGiB() { + return this.diskReadGiB; + } + + /** + * Set the diskReadGiB value. + * + * @param diskReadGiB the diskReadGiB value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withDiskReadGiB(double diskReadGiB) { + this.diskReadGiB = diskReadGiB; + return this; + } + + /** + * Get the diskWriteGiB value. + * + * @return the diskWriteGiB value + */ + public double diskWriteGiB() { + return this.diskWriteGiB; + } + + /** + * Set the diskWriteGiB value. + * + * @param diskWriteGiB the diskWriteGiB value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withDiskWriteGiB(double diskWriteGiB) { + this.diskWriteGiB = diskWriteGiB; + return this; + } + + /** + * Get the networkReadGiB value. + * + * @return the networkReadGiB value + */ + public double networkReadGiB() { + return this.networkReadGiB; + } + + /** + * Set the networkReadGiB value. + * + * @param networkReadGiB the networkReadGiB value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withNetworkReadGiB(double networkReadGiB) { + this.networkReadGiB = networkReadGiB; + return this; + } + + /** + * Get the networkWriteGiB value. + * + * @return the networkWriteGiB value + */ + public double networkWriteGiB() { + return this.networkWriteGiB; + } + + /** + * Set the networkWriteGiB value. + * + * @param networkWriteGiB the networkWriteGiB value to set + * @return the ResourceStatistics object itself. + */ + public ResourceStatistics withNetworkWriteGiB(double networkWriteGiB) { + this.networkWriteGiB = networkWriteGiB; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/Schedule.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/Schedule.java new file mode 100644 index 000000000000..dfd47e91b982 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/Schedule.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The schedule according to which jobs will be created. + */ +public class Schedule { + /** + * The earliest time at which any job may be created under this job + * schedule. + * If you do not specify a doNotRunUntil time, the schedule becomes ready + * to create jobs immediately. + */ + @JsonProperty(value = "doNotRunUntil") + private DateTime doNotRunUntil; + + /** + * A time after which no job will be created under this job schedule. The + * schedule will move to the completed state as soon as this deadline is + * past and there is no active job under this job schedule. + * If you do not specify a doNotRunAfter time, and you are creating a + * recurring job schedule, the job schedule will remain active until you + * explicitly terminate it. + */ + @JsonProperty(value = "doNotRunAfter") + private DateTime doNotRunAfter; + + /** + * The time interval, starting from the time at which the schedule + * indicates a job should be created, within which a job must be created. + * If a job is not created within the startWindow interval, then the + * 'opportunity' is lost; no job will be created until the next recurrence + * of the schedule. If the schedule is recurring, and the startWindow is + * longer than the recurrence interval, then this is equivalent to an + * infinite startWindow, because the job that is 'due' in one + * recurrenceInterval is not carried forward into the next recurrence + * interval. The default is infinite. The minimum value is 1 minute. If you + * specify a lower value, the Batch service rejects the schedule with an + * error; if you are calling the REST API directly, the HTTP status code is + * 400 (Bad Request). + */ + @JsonProperty(value = "startWindow") + private Period startWindow; + + /** + * The time interval between the start times of two successive jobs under + * the job schedule. A job schedule can have at most one active job under + * it at any given time. + * Because a job schedule can have at most one active job under it at any + * given time, if it is time to create a new job under a job schedule, but + * the previous job is still running, the Batch service will not create the + * new job until the previous job finishes. If the previous job does not + * finish within the startWindow period of the new recurrenceInterval, then + * no new job will be scheduled for that interval. For recurring jobs, you + * should normally specify a jobManagerTask in the jobSpecification. If you + * do not use jobManagerTask, you will need an external process to monitor + * when jobs are created, add tasks to the jobs and terminate the jobs + * ready for the next recurrence. The default is that the schedule does not + * recur: one job is created, within the startWindow after the + * doNotRunUntil time, and the schedule is complete as soon as that job + * finishes. The minimum value is 1 minute. If you specify a lower value, + * the Batch service rejects the schedule with an error; if you are calling + * the REST API directly, the HTTP status code is 400 (Bad Request). + */ + @JsonProperty(value = "recurrenceInterval") + private Period recurrenceInterval; + + /** + * Get if you do not specify a doNotRunUntil time, the schedule becomes ready to create jobs immediately. + * + * @return the doNotRunUntil value + */ + public DateTime doNotRunUntil() { + return this.doNotRunUntil; + } + + /** + * Set if you do not specify a doNotRunUntil time, the schedule becomes ready to create jobs immediately. + * + * @param doNotRunUntil the doNotRunUntil value to set + * @return the Schedule object itself. + */ + public Schedule withDoNotRunUntil(DateTime doNotRunUntil) { + this.doNotRunUntil = doNotRunUntil; + return this; + } + + /** + * Get if you do not specify a doNotRunAfter time, and you are creating a recurring job schedule, the job schedule will remain active until you explicitly terminate it. + * + * @return the doNotRunAfter value + */ + public DateTime doNotRunAfter() { + return this.doNotRunAfter; + } + + /** + * Set if you do not specify a doNotRunAfter time, and you are creating a recurring job schedule, the job schedule will remain active until you explicitly terminate it. + * + * @param doNotRunAfter the doNotRunAfter value to set + * @return the Schedule object itself. + */ + public Schedule withDoNotRunAfter(DateTime doNotRunAfter) { + this.doNotRunAfter = doNotRunAfter; + return this; + } + + /** + * Get if a job is not created within the startWindow interval, then the 'opportunity' is lost; no job will be created until the next recurrence of the schedule. If the schedule is recurring, and the startWindow is longer than the recurrence interval, then this is equivalent to an infinite startWindow, because the job that is 'due' in one recurrenceInterval is not carried forward into the next recurrence interval. The default is infinite. The minimum value is 1 minute. If you specify a lower value, the Batch service rejects the schedule with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @return the startWindow value + */ + public Period startWindow() { + return this.startWindow; + } + + /** + * Set if a job is not created within the startWindow interval, then the 'opportunity' is lost; no job will be created until the next recurrence of the schedule. If the schedule is recurring, and the startWindow is longer than the recurrence interval, then this is equivalent to an infinite startWindow, because the job that is 'due' in one recurrenceInterval is not carried forward into the next recurrence interval. The default is infinite. The minimum value is 1 minute. If you specify a lower value, the Batch service rejects the schedule with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @param startWindow the startWindow value to set + * @return the Schedule object itself. + */ + public Schedule withStartWindow(Period startWindow) { + this.startWindow = startWindow; + return this; + } + + /** + * Get because a job schedule can have at most one active job under it at any given time, if it is time to create a new job under a job schedule, but the previous job is still running, the Batch service will not create the new job until the previous job finishes. If the previous job does not finish within the startWindow period of the new recurrenceInterval, then no new job will be scheduled for that interval. For recurring jobs, you should normally specify a jobManagerTask in the jobSpecification. If you do not use jobManagerTask, you will need an external process to monitor when jobs are created, add tasks to the jobs and terminate the jobs ready for the next recurrence. The default is that the schedule does not recur: one job is created, within the startWindow after the doNotRunUntil time, and the schedule is complete as soon as that job finishes. The minimum value is 1 minute. If you specify a lower value, the Batch service rejects the schedule with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @return the recurrenceInterval value + */ + public Period recurrenceInterval() { + return this.recurrenceInterval; + } + + /** + * Set because a job schedule can have at most one active job under it at any given time, if it is time to create a new job under a job schedule, but the previous job is still running, the Batch service will not create the new job until the previous job finishes. If the previous job does not finish within the startWindow period of the new recurrenceInterval, then no new job will be scheduled for that interval. For recurring jobs, you should normally specify a jobManagerTask in the jobSpecification. If you do not use jobManagerTask, you will need an external process to monitor when jobs are created, add tasks to the jobs and terminate the jobs ready for the next recurrence. The default is that the schedule does not recur: one job is created, within the startWindow after the doNotRunUntil time, and the schedule is complete as soon as that job finishes. The minimum value is 1 minute. If you specify a lower value, the Batch service rejects the schedule with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + * + * @param recurrenceInterval the recurrenceInterval value to set + * @return the Schedule object itself. + */ + public Schedule withRecurrenceInterval(Period recurrenceInterval) { + this.recurrenceInterval = recurrenceInterval; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/SchedulingState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/SchedulingState.java new file mode 100644 index 000000000000..d3ccd8efea70 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/SchedulingState.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SchedulingState. + */ +public enum SchedulingState { + /** Tasks can be scheduled on the node. */ + ENABLED("enabled"), + + /** No new tasks will be scheduled on the node. Tasks already running on the node may still run to completion. All nodes start with scheduling enabled. */ + DISABLED("disabled"); + + /** The actual serialized value for a SchedulingState instance. */ + private String value; + + SchedulingState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SchedulingState instance. + * + * @param value the serialized value to parse. + * @return the parsed SchedulingState object, or null if unable to parse. + */ + @JsonCreator + public static SchedulingState fromString(String value) { + SchedulingState[] items = SchedulingState.values(); + for (SchedulingState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StartTask.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StartTask.java new file mode 100644 index 000000000000..912260a6f055 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StartTask.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A task which is run when a compute node joins a pool in the Azure Batch + * service, or when the compute node is rebooted or reimaged. + * Batch will retry tasks when a recovery operation is triggered on a compute + * node. Examples of recovery operations include (but are not limited to) when + * an unhealthy compute node is rebooted or a compute node disappeared due to + * host failure. Retries due to recovery operations are independent of and are + * not counted against the maxTaskRetryCount. Even if the maxTaskRetryCount is + * 0, an internal retry due to a recovery operation may occur. Because of this, + * all tasks should be idempotent. This means tasks need to tolerate being + * interrupted and restarted without causing any corruption or duplicate data. + * The best practice for long running tasks is to use some form of + * checkpointing. + */ +public class StartTask { + /** + * The command line of the start task. + * The command line does not run under a shell, and therefore cannot take + * advantage of shell features such as environment variable expansion. If + * you want to take advantage of such features, you should invoke the shell + * in the command line, for example using "cmd /c MyCommand" in Windows or + * "/bin/sh -c MyCommand" in Linux. If the command line refers to file + * paths, it should use a relative path (relative to the task working + * directory), or use the Batch provided environment variable + * (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + */ + @JsonProperty(value = "commandLine", required = true) + private String commandLine; + + /** + * The settings for the container under which the start task runs. + * When this is specified, all directories recursively below the + * AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) + * are mapped into the container, all task environment variables are mapped + * into the container, and the task command line is executed in the + * container. + */ + @JsonProperty(value = "containerSettings") + private TaskContainerSettings containerSettings; + + /** + * A list of files that the Batch service will download to the compute node + * before running the command line. There is a maximum size for the list + * of resource files. When the max size is exceeded, the request will fail + * and the response error code will be RequestEntityTooLarge. If this + * occurs, the collection of ResourceFiles must be reduced in size. This + * can be achieved using .zip files, Application Packages, or Docker + * Containers. + * Files listed under this element are located in the task's working + * directory. + */ + @JsonProperty(value = "resourceFiles") + private List resourceFiles; + + /** + * A list of environment variable settings for the start task. + */ + @JsonProperty(value = "environmentSettings") + private List environmentSettings; + + /** + * The user identity under which the start task runs. + * If omitted, the task runs as a non-administrative user unique to the + * task. + */ + @JsonProperty(value = "userIdentity") + private UserIdentity userIdentity; + + /** + * The maximum number of times the task may be retried. + * The Batch service retries a task if its exit code is nonzero. Note that + * this value specifically controls the number of retries. The Batch + * service will try the task once, and may then retry up to this limit. For + * example, if the maximum retry count is 3, Batch tries the task up to 4 + * times (one initial try and 3 retries). If the maximum retry count is 0, + * the Batch service does not retry the task. If the maximum retry count is + * -1, the Batch service retries the task without limit. + */ + @JsonProperty(value = "maxTaskRetryCount") + private Integer maxTaskRetryCount; + + /** + * Whether the Batch service should wait for the start task to complete + * successfully (that is, to exit with exit code 0) before scheduling any + * tasks on the compute node. + * If true and the start task fails on a compute node, the Batch service + * retries the start task up to its maximum retry count + * (maxTaskRetryCount). If the task has still not completed successfully + * after all retries, then the Batch service marks the compute node + * unusable, and will not schedule tasks to it. This condition can be + * detected via the node state and failure info details. If false, the + * Batch service will not wait for the start task to complete. In this + * case, other tasks can start executing on the compute node while the + * start task is still running; and even if the start task fails, new tasks + * will continue to be scheduled on the node. The default is false. + */ + @JsonProperty(value = "waitForSuccess") + private Boolean waitForSuccess; + + /** + * Get the command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @return the commandLine value + */ + public String commandLine() { + return this.commandLine; + } + + /** + * Set the command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @param commandLine the commandLine value to set + * @return the StartTask object itself. + */ + public StartTask withCommandLine(String commandLine) { + this.commandLine = commandLine; + return this; + } + + /** + * Get when this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @return the containerSettings value + */ + public TaskContainerSettings containerSettings() { + return this.containerSettings; + } + + /** + * Set when this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @param containerSettings the containerSettings value to set + * @return the StartTask object itself. + */ + public StartTask withContainerSettings(TaskContainerSettings containerSettings) { + this.containerSettings = containerSettings; + return this; + } + + /** + * Get files listed under this element are located in the task's working directory. + * + * @return the resourceFiles value + */ + public List resourceFiles() { + return this.resourceFiles; + } + + /** + * Set files listed under this element are located in the task's working directory. + * + * @param resourceFiles the resourceFiles value to set + * @return the StartTask object itself. + */ + public StartTask withResourceFiles(List resourceFiles) { + this.resourceFiles = resourceFiles; + return this; + } + + /** + * Get the environmentSettings value. + * + * @return the environmentSettings value + */ + public List environmentSettings() { + return this.environmentSettings; + } + + /** + * Set the environmentSettings value. + * + * @param environmentSettings the environmentSettings value to set + * @return the StartTask object itself. + */ + public StartTask withEnvironmentSettings(List environmentSettings) { + this.environmentSettings = environmentSettings; + return this; + } + + /** + * Get if omitted, the task runs as a non-administrative user unique to the task. + * + * @return the userIdentity value + */ + public UserIdentity userIdentity() { + return this.userIdentity; + } + + /** + * Set if omitted, the task runs as a non-administrative user unique to the task. + * + * @param userIdentity the userIdentity value to set + * @return the StartTask object itself. + */ + public StartTask withUserIdentity(UserIdentity userIdentity) { + this.userIdentity = userIdentity; + return this; + } + + /** + * Get the Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit. + * + * @return the maxTaskRetryCount value + */ + public Integer maxTaskRetryCount() { + return this.maxTaskRetryCount; + } + + /** + * Set the Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit. + * + * @param maxTaskRetryCount the maxTaskRetryCount value to set + * @return the StartTask object itself. + */ + public StartTask withMaxTaskRetryCount(Integer maxTaskRetryCount) { + this.maxTaskRetryCount = maxTaskRetryCount; + return this; + } + + /** + * Get if true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and failure info details. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is false. + * + * @return the waitForSuccess value + */ + public Boolean waitForSuccess() { + return this.waitForSuccess; + } + + /** + * Set if true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and failure info details. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is false. + * + * @param waitForSuccess the waitForSuccess value to set + * @return the StartTask object itself. + */ + public StartTask withWaitForSuccess(Boolean waitForSuccess) { + this.waitForSuccess = waitForSuccess; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StartTaskInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StartTaskInformation.java new file mode 100644 index 000000000000..9aec04346754 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StartTaskInformation.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a start task running on a compute node. + */ +public class StartTaskInformation { + /** + * The state of the start task on the compute node. + * Possible values include: 'running', 'completed'. + */ + @JsonProperty(value = "state", required = true) + private StartTaskState state; + + /** + * The time at which the start task started running. + * This value is reset every time the task is restarted or retried (that + * is, this is the most recent time at which the start task started + * running). + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The time at which the start task stopped running. + * This is the end time of the most recent run of the start task, if that + * run has completed (even if that run failed and a retry is pending). This + * element is not present if the start task is currently running. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * The exit code of the program specified on the start task command line. + * This property is set only if the start task is in the completed state. + * In general, the exit code for a process reflects the specific convention + * implemented by the application developer for that process. If you use + * the exit code value to make decisions in your code, be sure that you + * know the exit code convention used by the application process. However, + * if the Batch service terminates the start task (due to timeout, or user + * termination via the API) you may see an operating system-defined exit + * code. + */ + @JsonProperty(value = "exitCode") + private Integer exitCode; + + /** + * Information about the container under which the task is executing. + * This property is set only if the task runs in a container context. + */ + @JsonProperty(value = "containerInfo") + private TaskContainerExecutionInformation containerInfo; + + /** + * Information describing the task failure, if any. + * This property is set only if the task is in the completed state and + * encountered a failure. + */ + @JsonProperty(value = "failureInfo") + private TaskFailureInformation failureInfo; + + /** + * The number of times the task has been retried by the Batch service. + * Task application failures (non-zero exit code) are retried, + * pre-processing errors (the task could not be run) and file upload errors + * are not retried. The Batch service will retry the task up to the limit + * specified by the constraints. + */ + @JsonProperty(value = "retryCount", required = true) + private int retryCount; + + /** + * The most recent time at which a retry of the task started running. + * This element is present only if the task was retried (i.e. retryCount is + * nonzero). If present, this is typically the same as startTime, but may + * be different if the task has been restarted for reasons other than + * retry; for example, if the compute node was rebooted during a retry, + * then the startTime is updated but the lastRetryTime is not. + */ + @JsonProperty(value = "lastRetryTime") + private DateTime lastRetryTime; + + /** + * The result of the task execution. + * If the value is 'failed', then the details of the failure can be found + * in the failureInfo property. Possible values include: 'success', + * 'failure'. + */ + @JsonProperty(value = "result") + private TaskExecutionResult result; + + /** + * Get possible values include: 'running', 'completed'. + * + * @return the state value + */ + public StartTaskState state() { + return this.state; + } + + /** + * Set possible values include: 'running', 'completed'. + * + * @param state the state value to set + * @return the StartTaskInformation object itself. + */ + public StartTaskInformation withState(StartTaskState state) { + this.state = state; + return this; + } + + /** + * Get this value is reset every time the task is restarted or retried (that is, this is the most recent time at which the start task started running). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set this value is reset every time the task is restarted or retried (that is, this is the most recent time at which the start task started running). + * + * @param startTime the startTime value to set + * @return the StartTaskInformation object itself. + */ + public StartTaskInformation withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get this is the end time of the most recent run of the start task, if that run has completed (even if that run failed and a retry is pending). This element is not present if the start task is currently running. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set this is the end time of the most recent run of the start task, if that run has completed (even if that run failed and a retry is pending). This element is not present if the start task is currently running. + * + * @param endTime the endTime value to set + * @return the StartTaskInformation object itself. + */ + public StartTaskInformation withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get this property is set only if the start task is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the start task (due to timeout, or user termination via the API) you may see an operating system-defined exit code. + * + * @return the exitCode value + */ + public Integer exitCode() { + return this.exitCode; + } + + /** + * Set this property is set only if the start task is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the start task (due to timeout, or user termination via the API) you may see an operating system-defined exit code. + * + * @param exitCode the exitCode value to set + * @return the StartTaskInformation object itself. + */ + public StartTaskInformation withExitCode(Integer exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get this property is set only if the task runs in a container context. + * + * @return the containerInfo value + */ + public TaskContainerExecutionInformation containerInfo() { + return this.containerInfo; + } + + /** + * Set this property is set only if the task runs in a container context. + * + * @param containerInfo the containerInfo value to set + * @return the StartTaskInformation object itself. + */ + public StartTaskInformation withContainerInfo(TaskContainerExecutionInformation containerInfo) { + this.containerInfo = containerInfo; + return this; + } + + /** + * Get this property is set only if the task is in the completed state and encountered a failure. + * + * @return the failureInfo value + */ + public TaskFailureInformation failureInfo() { + return this.failureInfo; + } + + /** + * Set this property is set only if the task is in the completed state and encountered a failure. + * + * @param failureInfo the failureInfo value to set + * @return the StartTaskInformation object itself. + */ + public StartTaskInformation withFailureInfo(TaskFailureInformation failureInfo) { + this.failureInfo = failureInfo; + return this; + } + + /** + * Get task application failures (non-zero exit code) are retried, pre-processing errors (the task could not be run) and file upload errors are not retried. The Batch service will retry the task up to the limit specified by the constraints. + * + * @return the retryCount value + */ + public int retryCount() { + return this.retryCount; + } + + /** + * Set task application failures (non-zero exit code) are retried, pre-processing errors (the task could not be run) and file upload errors are not retried. The Batch service will retry the task up to the limit specified by the constraints. + * + * @param retryCount the retryCount value to set + * @return the StartTaskInformation object itself. + */ + public StartTaskInformation withRetryCount(int retryCount) { + this.retryCount = retryCount; + return this; + } + + /** + * Get this element is present only if the task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the task has been restarted for reasons other than retry; for example, if the compute node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not. + * + * @return the lastRetryTime value + */ + public DateTime lastRetryTime() { + return this.lastRetryTime; + } + + /** + * Set this element is present only if the task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the task has been restarted for reasons other than retry; for example, if the compute node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not. + * + * @param lastRetryTime the lastRetryTime value to set + * @return the StartTaskInformation object itself. + */ + public StartTaskInformation withLastRetryTime(DateTime lastRetryTime) { + this.lastRetryTime = lastRetryTime; + return this; + } + + /** + * Get if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'. + * + * @return the result value + */ + public TaskExecutionResult result() { + return this.result; + } + + /** + * Set if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'. + * + * @param result the result value to set + * @return the StartTaskInformation object itself. + */ + public StartTaskInformation withResult(TaskExecutionResult result) { + this.result = result; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StartTaskState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StartTaskState.java new file mode 100644 index 000000000000..68b024ba19ad --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StartTaskState.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for StartTaskState. + */ +public enum StartTaskState { + /** The start task is currently running. */ + RUNNING("running"), + + /** The start task has exited with exit code 0, or the start task has failed and the retry limit has reached, or the start task process did not run due to task preparation errors (such as resource file download failures). */ + COMPLETED("completed"); + + /** The actual serialized value for a StartTaskState instance. */ + private String value; + + StartTaskState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StartTaskState instance. + * + * @param value the serialized value to parse. + * @return the parsed StartTaskState object, or null if unable to parse. + */ + @JsonCreator + public static StartTaskState fromString(String value) { + StartTaskState[] items = StartTaskState.values(); + for (StartTaskState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StorageAccountType.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StorageAccountType.java new file mode 100644 index 000000000000..d57b330594e1 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/StorageAccountType.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for StorageAccountType. + */ +public enum StorageAccountType { + /** The data disk should use standard locally redundant storage. */ + STANDARD_LRS("standard_lrs"), + + /** The data disk should use premium locally redundant storage. */ + PREMIUM_LRS("premium_lrs"); + + /** The actual serialized value for a StorageAccountType instance. */ + private String value; + + StorageAccountType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StorageAccountType instance. + * + * @param value the serialized value to parse. + * @return the parsed StorageAccountType object, or null if unable to parse. + */ + @JsonCreator + public static StorageAccountType fromString(String value) { + StorageAccountType[] items = StorageAccountType.values(); + for (StorageAccountType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/SubtaskInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/SubtaskInformation.java new file mode 100644 index 000000000000..6c2cc6c1a7dd --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/SubtaskInformation.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about an Azure Batch subtask. + */ +public class SubtaskInformation { + /** + * The ID of the subtask. + */ + @JsonProperty(value = "id") + private Integer id; + + /** + * Information about the compute node on which the subtask ran. + */ + @JsonProperty(value = "nodeInfo") + private ComputeNodeInformation nodeInfo; + + /** + * The time at which the subtask started running. If the subtask has been + * restarted or retried, this is the most recent time at which the subtask + * started running. + */ + @JsonProperty(value = "startTime") + private DateTime startTime; + + /** + * The time at which the subtask completed. + * This property is set only if the subtask is in the Completed state. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * The exit code of the program specified on the subtask command line. + * This property is set only if the subtask is in the completed state. In + * general, the exit code for a process reflects the specific convention + * implemented by the application developer for that process. If you use + * the exit code value to make decisions in your code, be sure that you + * know the exit code convention used by the application process. However, + * if the Batch service terminates the subtask (due to timeout, or user + * termination via the API) you may see an operating system-defined exit + * code. + */ + @JsonProperty(value = "exitCode") + private Integer exitCode; + + /** + * Information about the container under which the task is executing. + * This property is set only if the task runs in a container context. + */ + @JsonProperty(value = "containerInfo") + private TaskContainerExecutionInformation containerInfo; + + /** + * Information describing the task failure, if any. + * This property is set only if the task is in the completed state and + * encountered a failure. + */ + @JsonProperty(value = "failureInfo") + private TaskFailureInformation failureInfo; + + /** + * The current state of the subtask. + * Possible values include: 'preparing', 'running', 'completed'. + */ + @JsonProperty(value = "state") + private SubtaskState state; + + /** + * The time at which the subtask entered its current state. + */ + @JsonProperty(value = "stateTransitionTime") + private DateTime stateTransitionTime; + + /** + * The previous state of the subtask. + * This property is not set if the subtask is in its initial running state. + * Possible values include: 'preparing', 'running', 'completed'. + */ + @JsonProperty(value = "previousState") + private SubtaskState previousState; + + /** + * The time at which the subtask entered its previous state. + * This property is not set if the subtask is in its initial running state. + */ + @JsonProperty(value = "previousStateTransitionTime") + private DateTime previousStateTransitionTime; + + /** + * The result of the task execution. + * If the value is 'failed', then the details of the failure can be found + * in the failureInfo property. Possible values include: 'success', + * 'failure'. + */ + @JsonProperty(value = "result") + private TaskExecutionResult result; + + /** + * Get the id value. + * + * @return the id value + */ + public Integer id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withId(Integer id) { + this.id = id; + return this; + } + + /** + * Get the nodeInfo value. + * + * @return the nodeInfo value + */ + public ComputeNodeInformation nodeInfo() { + return this.nodeInfo; + } + + /** + * Set the nodeInfo value. + * + * @param nodeInfo the nodeInfo value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withNodeInfo(ComputeNodeInformation nodeInfo) { + this.nodeInfo = nodeInfo; + return this; + } + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime value. + * + * @param startTime the startTime value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get this property is set only if the subtask is in the Completed state. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set this property is set only if the subtask is in the Completed state. + * + * @param endTime the endTime value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get this property is set only if the subtask is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the subtask (due to timeout, or user termination via the API) you may see an operating system-defined exit code. + * + * @return the exitCode value + */ + public Integer exitCode() { + return this.exitCode; + } + + /** + * Set this property is set only if the subtask is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the subtask (due to timeout, or user termination via the API) you may see an operating system-defined exit code. + * + * @param exitCode the exitCode value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withExitCode(Integer exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get this property is set only if the task runs in a container context. + * + * @return the containerInfo value + */ + public TaskContainerExecutionInformation containerInfo() { + return this.containerInfo; + } + + /** + * Set this property is set only if the task runs in a container context. + * + * @param containerInfo the containerInfo value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withContainerInfo(TaskContainerExecutionInformation containerInfo) { + this.containerInfo = containerInfo; + return this; + } + + /** + * Get this property is set only if the task is in the completed state and encountered a failure. + * + * @return the failureInfo value + */ + public TaskFailureInformation failureInfo() { + return this.failureInfo; + } + + /** + * Set this property is set only if the task is in the completed state and encountered a failure. + * + * @param failureInfo the failureInfo value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withFailureInfo(TaskFailureInformation failureInfo) { + this.failureInfo = failureInfo; + return this; + } + + /** + * Get possible values include: 'preparing', 'running', 'completed'. + * + * @return the state value + */ + public SubtaskState state() { + return this.state; + } + + /** + * Set possible values include: 'preparing', 'running', 'completed'. + * + * @param state the state value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withState(SubtaskState state) { + this.state = state; + return this; + } + + /** + * Get the stateTransitionTime value. + * + * @return the stateTransitionTime value + */ + public DateTime stateTransitionTime() { + return this.stateTransitionTime; + } + + /** + * Set the stateTransitionTime value. + * + * @param stateTransitionTime the stateTransitionTime value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withStateTransitionTime(DateTime stateTransitionTime) { + this.stateTransitionTime = stateTransitionTime; + return this; + } + + /** + * Get this property is not set if the subtask is in its initial running state. Possible values include: 'preparing', 'running', 'completed'. + * + * @return the previousState value + */ + public SubtaskState previousState() { + return this.previousState; + } + + /** + * Set this property is not set if the subtask is in its initial running state. Possible values include: 'preparing', 'running', 'completed'. + * + * @param previousState the previousState value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withPreviousState(SubtaskState previousState) { + this.previousState = previousState; + return this; + } + + /** + * Get this property is not set if the subtask is in its initial running state. + * + * @return the previousStateTransitionTime value + */ + public DateTime previousStateTransitionTime() { + return this.previousStateTransitionTime; + } + + /** + * Set this property is not set if the subtask is in its initial running state. + * + * @param previousStateTransitionTime the previousStateTransitionTime value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withPreviousStateTransitionTime(DateTime previousStateTransitionTime) { + this.previousStateTransitionTime = previousStateTransitionTime; + return this; + } + + /** + * Get if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'. + * + * @return the result value + */ + public TaskExecutionResult result() { + return this.result; + } + + /** + * Set if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'. + * + * @param result the result value to set + * @return the SubtaskInformation object itself. + */ + public SubtaskInformation withResult(TaskExecutionResult result) { + this.result = result; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/SubtaskState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/SubtaskState.java new file mode 100644 index 000000000000..23d882515253 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/SubtaskState.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SubtaskState. + */ +public enum SubtaskState { + /** The task has been assigned to a compute node, but is waiting for a required Job Preparation task to complete on the node. If the Job Preparation task succeeds, the task will move to running. If the Job Preparation task fails, the task will return to active and will be eligible to be assigned to a different node. */ + PREPARING("preparing"), + + /** The task is running on a compute node. This includes task-level preparation such as downloading resource files or deploying application packages specified on the task - it does not necessarily mean that the task command line has started executing. */ + RUNNING("running"), + + /** The task is no longer eligible to run, usually because the task has finished successfully, or the task has finished unsuccessfully and has exhausted its retry limit. A task is also marked as completed if an error occurred launching the task, or when the task has been terminated. */ + COMPLETED("completed"); + + /** The actual serialized value for a SubtaskState instance. */ + private String value; + + SubtaskState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SubtaskState instance. + * + * @param value the serialized value to parse. + * @return the parsed SubtaskState object, or null if unable to parse. + */ + @JsonCreator + public static SubtaskState fromString(String value) { + SubtaskState[] items = SubtaskState.values(); + for (SubtaskState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionHeaders.java new file mode 100644 index 000000000000..ac779fe04511 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionHeaders.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for AddCollection operation. + */ +public class TaskAddCollectionHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private String clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private String requestId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskAddCollectionHeaders object itself. + */ + public TaskAddCollectionHeaders withClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the TaskAddCollectionHeaders object itself. + */ + public TaskAddCollectionHeaders withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionOptions.java new file mode 100644 index 000000000000..f7b4ede5fc76 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for addCollection operation. + */ +public class TaskAddCollectionOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the TaskAddCollectionOptions object itself. + */ + public TaskAddCollectionOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskAddCollectionOptions object itself. + */ + public TaskAddCollectionOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the TaskAddCollectionOptions object itself. + */ + public TaskAddCollectionOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the TaskAddCollectionOptions object itself. + */ + public TaskAddCollectionOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionParameter.java new file mode 100644 index 000000000000..af7fd98e7574 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionParameter.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A collection of Azure Batch tasks to add. + */ +public class TaskAddCollectionParameter { + /** + * The collection of tasks to add. The maximum count of tasks is 100. + * The total serialized size of this collection must be less than 1MB. If + * it is greater than 1MB (for example if each task has 100's of resource + * files or environment variables), the request will fail with code + * 'RequestBodyTooLarge' and should be retried again with fewer tasks. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks. + * + * @param value the value value to set + * @return the TaskAddCollectionParameter object itself. + */ + public TaskAddCollectionParameter withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionResult.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionResult.java new file mode 100644 index 000000000000..3073f8c65d72 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddCollectionResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result of adding a collection of tasks to a job. + */ +public class TaskAddCollectionResult { + /** + * The results of the add task collection operation. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value value. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the TaskAddCollectionResult object itself. + */ + public TaskAddCollectionResult withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddHeaders.java new file mode 100644 index 000000000000..f55a098a8f5d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Add operation. + */ +public class TaskAddHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskAddHeaders object itself. + */ + public TaskAddHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the TaskAddHeaders object itself. + */ + public TaskAddHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the TaskAddHeaders object itself. + */ + public TaskAddHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the TaskAddHeaders object itself. + */ + public TaskAddHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the TaskAddHeaders object itself. + */ + public TaskAddHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddOptions.java new file mode 100644 index 000000000000..1623fc23306e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for add operation. + */ +public class TaskAddOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the TaskAddOptions object itself. + */ + public TaskAddOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskAddOptions object itself. + */ + public TaskAddOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the TaskAddOptions object itself. + */ + public TaskAddOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the TaskAddOptions object itself. + */ + public TaskAddOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddParameter.java new file mode 100644 index 000000000000..2949de2542f3 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddParameter.java @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Azure Batch task to add. + * Batch will retry tasks when a recovery operation is triggered on a compute + * node. Examples of recovery operations include (but are not limited to) when + * an unhealthy compute node is rebooted or a compute node disappeared due to + * host failure. Retries due to recovery operations are independent of and are + * not counted against the maxTaskRetryCount. Even if the maxTaskRetryCount is + * 0, an internal retry due to a recovery operation may occur. Because of this, + * all tasks should be idempotent. This means tasks need to tolerate being + * interrupted and restarted without causing any corruption or duplicate data. + * The best practice for long running tasks is to use some form of + * checkpointing. + */ +public class TaskAddParameter { + /** + * A string that uniquely identifies the task within the job. + * The ID can contain any combination of alphanumeric characters including + * hyphens and underscores, and cannot contain more than 64 characters. The + * ID is case-preserving and case-insensitive (that is, you may not have + * two IDs within a job that differ only by case). + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * A display name for the task. + * The display name need not be unique and can contain any Unicode + * characters up to a maximum length of 1024. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The command line of the task. + * For multi-instance tasks, the command line is executed as the primary + * task, after the primary task and all subtasks have finished executing + * the coordination command line. The command line does not run under a + * shell, and therefore cannot take advantage of shell features such as + * environment variable expansion. If you want to take advantage of such + * features, you should invoke the shell in the command line, for example + * using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. + * If the command line refers to file paths, it should use a relative path + * (relative to the task working directory), or use the Batch provided + * environment variable + * (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + */ + @JsonProperty(value = "commandLine", required = true) + private String commandLine; + + /** + * The settings for the container under which the task runs. + * If the pool that will run this task has containerConfiguration set, this + * must be set as well. If the pool that will run this task doesn't have + * containerConfiguration set, this must not be set. When this is + * specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR + * (the root of Azure Batch directories on the node) are mapped into the + * container, all task environment variables are mapped into the container, + * and the task command line is executed in the container. + */ + @JsonProperty(value = "containerSettings") + private TaskContainerSettings containerSettings; + + /** + * How the Batch service should respond when the task completes. + */ + @JsonProperty(value = "exitConditions") + private ExitConditions exitConditions; + + /** + * A list of files that the Batch service will download to the compute node + * before running the command line. + * For multi-instance tasks, the resource files will only be downloaded to + * the compute node on which the primary task is executed. There is a + * maximum size for the list of resource files. When the max size is + * exceeded, the request will fail and the response error code will be + * RequestEntityTooLarge. If this occurs, the collection of ResourceFiles + * must be reduced in size. This can be achieved using .zip files, + * Application Packages, or Docker Containers. + */ + @JsonProperty(value = "resourceFiles") + private List resourceFiles; + + /** + * A list of files that the Batch service will upload from the compute node + * after running the command line. + * For multi-instance tasks, the files will only be uploaded from the + * compute node on which the primary task is executed. + */ + @JsonProperty(value = "outputFiles") + private List outputFiles; + + /** + * A list of environment variable settings for the task. + */ + @JsonProperty(value = "environmentSettings") + private List environmentSettings; + + /** + * A locality hint that can be used by the Batch service to select a + * compute node on which to start the new task. + */ + @JsonProperty(value = "affinityInfo") + private AffinityInformation affinityInfo; + + /** + * The execution constraints that apply to this task. + * If you do not specify constraints, the maxTaskRetryCount is the + * maxTaskRetryCount specified for the job, the maxWallClockTime is + * infinite, and the retentionTime is 7 days. + */ + @JsonProperty(value = "constraints") + private TaskConstraints constraints; + + /** + * The user identity under which the task runs. + * If omitted, the task runs as a non-administrative user unique to the + * task. + */ + @JsonProperty(value = "userIdentity") + private UserIdentity userIdentity; + + /** + * An object that indicates that the task is a multi-instance task, and + * contains information about how to run the multi-instance task. + */ + @JsonProperty(value = "multiInstanceSettings") + private MultiInstanceSettings multiInstanceSettings; + + /** + * The tasks that this task depends on. + * This task will not be scheduled until all tasks that it depends on have + * completed successfully. If any of those tasks fail and exhaust their + * retry counts, this task will never be scheduled. If the job does not + * have usesTaskDependencies set to true, and this element is present, the + * request fails with error code TaskDependenciesNotSpecifiedOnJob. + */ + @JsonProperty(value = "dependsOn") + private TaskDependencies dependsOn; + + /** + * A list of application packages that the Batch service will deploy to the + * compute node before running the command line. + * Application packages are downloaded and deployed to a shared directory, + * not the task working directory. Therefore, if a referenced package is + * already on the compute node, and is up to date, then it is not + * re-downloaded; the existing copy on the compute node is used. If a + * referenced application package cannot be installed, for example because + * the package has been deleted or because download failed, the task fails. + */ + @JsonProperty(value = "applicationPackageReferences") + private List applicationPackageReferences; + + /** + * The settings for an authentication token that the task can use to + * perform Batch service operations. + * If this property is set, the Batch service provides the task with an + * authentication token which can be used to authenticate Batch service + * operations without requiring an account access key. The token is + * provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The + * operations that the task can carry out using the token depend on the + * settings. For example, a task can request job permissions in order to + * add other tasks to the job, or check the status of the job or of other + * tasks under the job. + */ + @JsonProperty(value = "authenticationTokenSettings") + private AuthenticationTokenSettings authenticationTokenSettings; + + /** + * Get the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a job that differ only by case). + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a job that differ only by case). + * + * @param id the id value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withId(String id) { + this.id = id; + return this; + } + + /** + * Get the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + * + * @param displayName the displayName value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get for multi-instance tasks, the command line is executed as the primary task, after the primary task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @return the commandLine value + */ + public String commandLine() { + return this.commandLine; + } + + /** + * Set for multi-instance tasks, the command line is executed as the primary task, after the primary task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + * + * @param commandLine the commandLine value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withCommandLine(String commandLine) { + this.commandLine = commandLine; + return this; + } + + /** + * Get if the pool that will run this task has containerConfiguration set, this must be set as well. If the pool that will run this task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @return the containerSettings value + */ + public TaskContainerSettings containerSettings() { + return this.containerSettings; + } + + /** + * Set if the pool that will run this task has containerConfiguration set, this must be set as well. If the pool that will run this task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + * + * @param containerSettings the containerSettings value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withContainerSettings(TaskContainerSettings containerSettings) { + this.containerSettings = containerSettings; + return this; + } + + /** + * Get how the Batch service should respond when the task completes. + * + * @return the exitConditions value + */ + public ExitConditions exitConditions() { + return this.exitConditions; + } + + /** + * Set how the Batch service should respond when the task completes. + * + * @param exitConditions the exitConditions value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withExitConditions(ExitConditions exitConditions) { + this.exitConditions = exitConditions; + return this; + } + + /** + * Get for multi-instance tasks, the resource files will only be downloaded to the compute node on which the primary task is executed. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + * + * @return the resourceFiles value + */ + public List resourceFiles() { + return this.resourceFiles; + } + + /** + * Set for multi-instance tasks, the resource files will only be downloaded to the compute node on which the primary task is executed. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + * + * @param resourceFiles the resourceFiles value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withResourceFiles(List resourceFiles) { + this.resourceFiles = resourceFiles; + return this; + } + + /** + * Get for multi-instance tasks, the files will only be uploaded from the compute node on which the primary task is executed. + * + * @return the outputFiles value + */ + public List outputFiles() { + return this.outputFiles; + } + + /** + * Set for multi-instance tasks, the files will only be uploaded from the compute node on which the primary task is executed. + * + * @param outputFiles the outputFiles value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withOutputFiles(List outputFiles) { + this.outputFiles = outputFiles; + return this; + } + + /** + * Get the environmentSettings value. + * + * @return the environmentSettings value + */ + public List environmentSettings() { + return this.environmentSettings; + } + + /** + * Set the environmentSettings value. + * + * @param environmentSettings the environmentSettings value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withEnvironmentSettings(List environmentSettings) { + this.environmentSettings = environmentSettings; + return this; + } + + /** + * Get the affinityInfo value. + * + * @return the affinityInfo value + */ + public AffinityInformation affinityInfo() { + return this.affinityInfo; + } + + /** + * Set the affinityInfo value. + * + * @param affinityInfo the affinityInfo value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withAffinityInfo(AffinityInformation affinityInfo) { + this.affinityInfo = affinityInfo; + return this; + } + + /** + * Get if you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the job, the maxWallClockTime is infinite, and the retentionTime is 7 days. + * + * @return the constraints value + */ + public TaskConstraints constraints() { + return this.constraints; + } + + /** + * Set if you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the job, the maxWallClockTime is infinite, and the retentionTime is 7 days. + * + * @param constraints the constraints value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withConstraints(TaskConstraints constraints) { + this.constraints = constraints; + return this; + } + + /** + * Get if omitted, the task runs as a non-administrative user unique to the task. + * + * @return the userIdentity value + */ + public UserIdentity userIdentity() { + return this.userIdentity; + } + + /** + * Set if omitted, the task runs as a non-administrative user unique to the task. + * + * @param userIdentity the userIdentity value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withUserIdentity(UserIdentity userIdentity) { + this.userIdentity = userIdentity; + return this; + } + + /** + * Get the multiInstanceSettings value. + * + * @return the multiInstanceSettings value + */ + public MultiInstanceSettings multiInstanceSettings() { + return this.multiInstanceSettings; + } + + /** + * Set the multiInstanceSettings value. + * + * @param multiInstanceSettings the multiInstanceSettings value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withMultiInstanceSettings(MultiInstanceSettings multiInstanceSettings) { + this.multiInstanceSettings = multiInstanceSettings; + return this; + } + + /** + * Get this task will not be scheduled until all tasks that it depends on have completed successfully. If any of those tasks fail and exhaust their retry counts, this task will never be scheduled. If the job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob. + * + * @return the dependsOn value + */ + public TaskDependencies dependsOn() { + return this.dependsOn; + } + + /** + * Set this task will not be scheduled until all tasks that it depends on have completed successfully. If any of those tasks fail and exhaust their retry counts, this task will never be scheduled. If the job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob. + * + * @param dependsOn the dependsOn value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withDependsOn(TaskDependencies dependsOn) { + this.dependsOn = dependsOn; + return this; + } + + /** + * Get application packages are downloaded and deployed to a shared directory, not the task working directory. Therefore, if a referenced package is already on the compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application package cannot be installed, for example because the package has been deleted or because download failed, the task fails. + * + * @return the applicationPackageReferences value + */ + public List applicationPackageReferences() { + return this.applicationPackageReferences; + } + + /** + * Set application packages are downloaded and deployed to a shared directory, not the task working directory. Therefore, if a referenced package is already on the compute node, and is up to date, then it is not re-downloaded; the existing copy on the compute node is used. If a referenced application package cannot be installed, for example because the package has been deleted or because download failed, the task fails. + * + * @param applicationPackageReferences the applicationPackageReferences value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withApplicationPackageReferences(List applicationPackageReferences) { + this.applicationPackageReferences = applicationPackageReferences; + return this; + } + + /** + * Get if this property is set, the Batch service provides the task with an authentication token which can be used to authenticate Batch service operations without requiring an account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the task can carry out using the token depend on the settings. For example, a task can request job permissions in order to add other tasks to the job, or check the status of the job or of other tasks under the job. + * + * @return the authenticationTokenSettings value + */ + public AuthenticationTokenSettings authenticationTokenSettings() { + return this.authenticationTokenSettings; + } + + /** + * Set if this property is set, the Batch service provides the task with an authentication token which can be used to authenticate Batch service operations without requiring an account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the task can carry out using the token depend on the settings. For example, a task can request job permissions in order to add other tasks to the job, or check the status of the job or of other tasks under the job. + * + * @param authenticationTokenSettings the authenticationTokenSettings value to set + * @return the TaskAddParameter object itself. + */ + public TaskAddParameter withAuthenticationTokenSettings(AuthenticationTokenSettings authenticationTokenSettings) { + this.authenticationTokenSettings = authenticationTokenSettings; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddResult.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddResult.java new file mode 100644 index 000000000000..0214667a9e15 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddResult.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result for a single task added as part of an add task collection operation. + */ +public class TaskAddResult { + /** + * The status of the add task request. + * Possible values include: 'success', 'clientError', 'serverError'. + */ + @JsonProperty(value = "status", required = true) + private TaskAddStatus status; + + /** + * The ID of the task for which this is the result. + */ + @JsonProperty(value = "taskId", required = true) + private String taskId; + + /** + * The ETag of the task, if the task was successfully added. + * You can use this to detect whether the task has changed between + * requests. In particular, you can be pass the ETag with an Update Task + * request to specify that your changes should take effect only if nobody + * else has modified the job in the meantime. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * The last modified time of the task. + */ + @JsonProperty(value = "lastModified") + private DateTime lastModified; + + /** + * The URL of the task, if the task was successfully added. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The error encountered while attempting to add the task. + */ + @JsonProperty(value = "error") + private BatchError error; + + /** + * Get possible values include: 'success', 'clientError', 'serverError'. + * + * @return the status value + */ + public TaskAddStatus status() { + return this.status; + } + + /** + * Set possible values include: 'success', 'clientError', 'serverError'. + * + * @param status the status value to set + * @return the TaskAddResult object itself. + */ + public TaskAddResult withStatus(TaskAddStatus status) { + this.status = status; + return this; + } + + /** + * Get the taskId value. + * + * @return the taskId value + */ + public String taskId() { + return this.taskId; + } + + /** + * Set the taskId value. + * + * @param taskId the taskId value to set + * @return the TaskAddResult object itself. + */ + public TaskAddResult withTaskId(String taskId) { + this.taskId = taskId; + return this; + } + + /** + * Get you can use this to detect whether the task has changed between requests. In particular, you can be pass the ETag with an Update Task request to specify that your changes should take effect only if nobody else has modified the job in the meantime. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set you can use this to detect whether the task has changed between requests. In particular, you can be pass the ETag with an Update Task request to specify that your changes should take effect only if nobody else has modified the job in the meantime. + * + * @param eTag the eTag value to set + * @return the TaskAddResult object itself. + */ + public TaskAddResult withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified value. + * + * @return the lastModified value + */ + public DateTime lastModified() { + return this.lastModified; + } + + /** + * Set the lastModified value. + * + * @param lastModified the lastModified value to set + * @return the TaskAddResult object itself. + */ + public TaskAddResult withLastModified(DateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the TaskAddResult object itself. + */ + public TaskAddResult withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the error value. + * + * @return the error value + */ + public BatchError error() { + return this.error; + } + + /** + * Set the error value. + * + * @param error the error value to set + * @return the TaskAddResult object itself. + */ + public TaskAddResult withError(BatchError error) { + this.error = error; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddStatus.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddStatus.java new file mode 100644 index 000000000000..d48265265196 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskAddStatus.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TaskAddStatus. + */ +public enum TaskAddStatus { + /** The task was added successfully. */ + SUCCESS("success"), + + /** The task failed to add due to a client error and should not be retried without modifying the request as appropriate. */ + CLIENT_ERROR("clienterror"), + + /** Task failed to add due to a server error and can be retried without modification. */ + SERVER_ERROR("servererror"); + + /** The actual serialized value for a TaskAddStatus instance. */ + private String value; + + TaskAddStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TaskAddStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed TaskAddStatus object, or null if unable to parse. + */ + @JsonCreator + public static TaskAddStatus fromString(String value) { + TaskAddStatus[] items = TaskAddStatus.values(); + for (TaskAddStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskConstraints.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskConstraints.java new file mode 100644 index 000000000000..448a8e5f8314 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskConstraints.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Execution constraints to apply to a task. + */ +public class TaskConstraints { + /** + * The maximum elapsed time that the task may run, measured from the time + * the task starts. If the task does not complete within the time limit, + * the Batch service terminates it. + * If this is not specified, there is no time limit on how long the task + * may run. + */ + @JsonProperty(value = "maxWallClockTime") + private Period maxWallClockTime; + + /** + * The minimum time to retain the task directory on the compute node where + * it ran, from the time it completes execution. After this time, the Batch + * service may delete the task directory and all its contents. + * The default is 7 days, i.e. the task directory will be retained for 7 + * days unless the compute node is removed or the job is deleted. + */ + @JsonProperty(value = "retentionTime") + private Period retentionTime; + + /** + * The maximum number of times the task may be retried. The Batch service + * retries a task if its exit code is nonzero. + * Note that this value specifically controls the number of retries for the + * task executable due to a nonzero exit code. The Batch service will try + * the task once, and may then retry up to this limit. For example, if the + * maximum retry count is 3, Batch tries the task up to 4 times (one + * initial try and 3 retries). If the maximum retry count is 0, the Batch + * service does not retry the task after the first attempt. If the maximum + * retry count is -1, the Batch service retries the task without limit. + */ + @JsonProperty(value = "maxTaskRetryCount") + private Integer maxTaskRetryCount; + + /** + * Get if this is not specified, there is no time limit on how long the task may run. + * + * @return the maxWallClockTime value + */ + public Period maxWallClockTime() { + return this.maxWallClockTime; + } + + /** + * Set if this is not specified, there is no time limit on how long the task may run. + * + * @param maxWallClockTime the maxWallClockTime value to set + * @return the TaskConstraints object itself. + */ + public TaskConstraints withMaxWallClockTime(Period maxWallClockTime) { + this.maxWallClockTime = maxWallClockTime; + return this; + } + + /** + * Get the default is 7 days, i.e. the task directory will be retained for 7 days unless the compute node is removed or the job is deleted. + * + * @return the retentionTime value + */ + public Period retentionTime() { + return this.retentionTime; + } + + /** + * Set the default is 7 days, i.e. the task directory will be retained for 7 days unless the compute node is removed or the job is deleted. + * + * @param retentionTime the retentionTime value to set + * @return the TaskConstraints object itself. + */ + public TaskConstraints withRetentionTime(Period retentionTime) { + this.retentionTime = retentionTime; + return this; + } + + /** + * Get note that this value specifically controls the number of retries for the task executable due to a nonzero exit code. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task after the first attempt. If the maximum retry count is -1, the Batch service retries the task without limit. + * + * @return the maxTaskRetryCount value + */ + public Integer maxTaskRetryCount() { + return this.maxTaskRetryCount; + } + + /** + * Set note that this value specifically controls the number of retries for the task executable due to a nonzero exit code. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task after the first attempt. If the maximum retry count is -1, the Batch service retries the task without limit. + * + * @param maxTaskRetryCount the maxTaskRetryCount value to set + * @return the TaskConstraints object itself. + */ + public TaskConstraints withMaxTaskRetryCount(Integer maxTaskRetryCount) { + this.maxTaskRetryCount = maxTaskRetryCount; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskContainerExecutionInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskContainerExecutionInformation.java new file mode 100644 index 000000000000..6a39255dfddc --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskContainerExecutionInformation.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about the container which a task is executing. + */ +public class TaskContainerExecutionInformation { + /** + * The ID of the container. + */ + @JsonProperty(value = "containerId") + private String containerId; + + /** + * The state of the container. + * This is the state of the container according to the Docker service. It + * is equivalent to the status field returned by "docker inspect". + */ + @JsonProperty(value = "state") + private String state; + + /** + * Detailed error information about the container. + * This is the detailed error string from the Docker service, if available. + * It is equivalent to the error field returned by "docker inspect". + */ + @JsonProperty(value = "error") + private String error; + + /** + * Get the containerId value. + * + * @return the containerId value + */ + public String containerId() { + return this.containerId; + } + + /** + * Set the containerId value. + * + * @param containerId the containerId value to set + * @return the TaskContainerExecutionInformation object itself. + */ + public TaskContainerExecutionInformation withContainerId(String containerId) { + this.containerId = containerId; + return this; + } + + /** + * Get this is the state of the container according to the Docker service. It is equivalent to the status field returned by "docker inspect". + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Set this is the state of the container according to the Docker service. It is equivalent to the status field returned by "docker inspect". + * + * @param state the state value to set + * @return the TaskContainerExecutionInformation object itself. + */ + public TaskContainerExecutionInformation withState(String state) { + this.state = state; + return this; + } + + /** + * Get this is the detailed error string from the Docker service, if available. It is equivalent to the error field returned by "docker inspect". + * + * @return the error value + */ + public String error() { + return this.error; + } + + /** + * Set this is the detailed error string from the Docker service, if available. It is equivalent to the error field returned by "docker inspect". + * + * @param error the error value to set + * @return the TaskContainerExecutionInformation object itself. + */ + public TaskContainerExecutionInformation withError(String error) { + this.error = error; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskContainerSettings.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskContainerSettings.java new file mode 100644 index 000000000000..e2998342bbcf --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskContainerSettings.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The container settings for a task. + */ +public class TaskContainerSettings { + /** + * Additional options to the container create command. + * These additional options are supplied as arguments to the "docker + * create" command, in addition to those controlled by the Batch Service. + */ + @JsonProperty(value = "containerRunOptions") + private String containerRunOptions; + + /** + * The image to use to create the container in which the task will run. + * This is the full image reference, as would be specified to "docker + * pull". If no tag is provided as part of the image name, the tag + * ":latest" is used as a default. + */ + @JsonProperty(value = "imageName", required = true) + private String imageName; + + /** + * The private registry which contains the container image. + * This setting can be omitted if was already provided at pool creation. + */ + @JsonProperty(value = "registry") + private ContainerRegistry registry; + + /** + * Get these additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. + * + * @return the containerRunOptions value + */ + public String containerRunOptions() { + return this.containerRunOptions; + } + + /** + * Set these additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. + * + * @param containerRunOptions the containerRunOptions value to set + * @return the TaskContainerSettings object itself. + */ + public TaskContainerSettings withContainerRunOptions(String containerRunOptions) { + this.containerRunOptions = containerRunOptions; + return this; + } + + /** + * Get this is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default. + * + * @return the imageName value + */ + public String imageName() { + return this.imageName; + } + + /** + * Set this is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default. + * + * @param imageName the imageName value to set + * @return the TaskContainerSettings object itself. + */ + public TaskContainerSettings withImageName(String imageName) { + this.imageName = imageName; + return this; + } + + /** + * Get this setting can be omitted if was already provided at pool creation. + * + * @return the registry value + */ + public ContainerRegistry registry() { + return this.registry; + } + + /** + * Set this setting can be omitted if was already provided at pool creation. + * + * @param registry the registry value to set + * @return the TaskContainerSettings object itself. + */ + public TaskContainerSettings withRegistry(ContainerRegistry registry) { + this.registry = registry; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskCounts.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskCounts.java new file mode 100644 index 000000000000..a279851a36ce --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskCounts.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The task counts for a job. + */ +public class TaskCounts { + /** + * The number of tasks in the active state. + */ + @JsonProperty(value = "active", required = true) + private int active; + + /** + * The number of tasks in the running or preparing state. + */ + @JsonProperty(value = "running", required = true) + private int running; + + /** + * The number of tasks in the completed state. + */ + @JsonProperty(value = "completed", required = true) + private int completed; + + /** + * The number of tasks which succeeded. A task succeeds if its result + * (found in the executionInfo property) is 'success'. + */ + @JsonProperty(value = "succeeded", required = true) + private int succeeded; + + /** + * The number of tasks which failed. A task fails if its result (found in + * the executionInfo property) is 'failure'. + */ + @JsonProperty(value = "failed", required = true) + private int failed; + + /** + * Get the active value. + * + * @return the active value + */ + public int active() { + return this.active; + } + + /** + * Set the active value. + * + * @param active the active value to set + * @return the TaskCounts object itself. + */ + public TaskCounts withActive(int active) { + this.active = active; + return this; + } + + /** + * Get the running value. + * + * @return the running value + */ + public int running() { + return this.running; + } + + /** + * Set the running value. + * + * @param running the running value to set + * @return the TaskCounts object itself. + */ + public TaskCounts withRunning(int running) { + this.running = running; + return this; + } + + /** + * Get the completed value. + * + * @return the completed value + */ + public int completed() { + return this.completed; + } + + /** + * Set the completed value. + * + * @param completed the completed value to set + * @return the TaskCounts object itself. + */ + public TaskCounts withCompleted(int completed) { + this.completed = completed; + return this; + } + + /** + * Get the succeeded value. + * + * @return the succeeded value + */ + public int succeeded() { + return this.succeeded; + } + + /** + * Set the succeeded value. + * + * @param succeeded the succeeded value to set + * @return the TaskCounts object itself. + */ + public TaskCounts withSucceeded(int succeeded) { + this.succeeded = succeeded; + return this; + } + + /** + * Get the failed value. + * + * @return the failed value + */ + public int failed() { + return this.failed; + } + + /** + * Set the failed value. + * + * @param failed the failed value to set + * @return the TaskCounts object itself. + */ + public TaskCounts withFailed(int failed) { + this.failed = failed; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskDeleteHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskDeleteHeaders.java new file mode 100644 index 000000000000..41f388ca7316 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskDeleteHeaders.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Delete operation. + */ +public class TaskDeleteHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private String clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private String requestId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskDeleteHeaders object itself. + */ + public TaskDeleteHeaders withClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the TaskDeleteHeaders object itself. + */ + public TaskDeleteHeaders withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskDeleteOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskDeleteOptions.java new file mode 100644 index 000000000000..d2e065c7002b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskDeleteOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for delete operation. + */ +public class TaskDeleteOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the TaskDeleteOptions object itself. + */ + public TaskDeleteOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskDeleteOptions object itself. + */ + public TaskDeleteOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the TaskDeleteOptions object itself. + */ + public TaskDeleteOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the TaskDeleteOptions object itself. + */ + public TaskDeleteOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the TaskDeleteOptions object itself. + */ + public TaskDeleteOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the TaskDeleteOptions object itself. + */ + public TaskDeleteOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the TaskDeleteOptions object itself. + */ + public TaskDeleteOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the TaskDeleteOptions object itself. + */ + public TaskDeleteOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskDependencies.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskDependencies.java new file mode 100644 index 000000000000..07baa3e90166 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskDependencies.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies any dependencies of a task. Any task that is explicitly specified + * or within a dependency range must complete before the dependant task will be + * scheduled. + */ +public class TaskDependencies { + /** + * The list of task IDs that this task depends on. All tasks in this list + * must complete successfully before the dependent task can be scheduled. + * The taskIds collection is limited to 64000 characters total (i.e. the + * combined length of all task IDs). If the taskIds collection exceeds the + * maximum length, the Add Task request fails with error code + * TaskDependencyListTooLong. In this case consider using task ID ranges + * instead. + */ + @JsonProperty(value = "taskIds") + private List taskIds; + + /** + * The list of task ID ranges that this task depends on. All tasks in all + * ranges must complete successfully before the dependent task can be + * scheduled. + */ + @JsonProperty(value = "taskIdRanges") + private List taskIdRanges; + + /** + * Get the taskIds collection is limited to 64000 characters total (i.e. the combined length of all task IDs). If the taskIds collection exceeds the maximum length, the Add Task request fails with error code TaskDependencyListTooLong. In this case consider using task ID ranges instead. + * + * @return the taskIds value + */ + public List taskIds() { + return this.taskIds; + } + + /** + * Set the taskIds collection is limited to 64000 characters total (i.e. the combined length of all task IDs). If the taskIds collection exceeds the maximum length, the Add Task request fails with error code TaskDependencyListTooLong. In this case consider using task ID ranges instead. + * + * @param taskIds the taskIds value to set + * @return the TaskDependencies object itself. + */ + public TaskDependencies withTaskIds(List taskIds) { + this.taskIds = taskIds; + return this; + } + + /** + * Get the taskIdRanges value. + * + * @return the taskIdRanges value + */ + public List taskIdRanges() { + return this.taskIdRanges; + } + + /** + * Set the taskIdRanges value. + * + * @param taskIdRanges the taskIdRanges value to set + * @return the TaskDependencies object itself. + */ + public TaskDependencies withTaskIdRanges(List taskIdRanges) { + this.taskIdRanges = taskIdRanges; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskExecutionInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskExecutionInformation.java new file mode 100644 index 000000000000..22ed5b05a860 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskExecutionInformation.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about the execution of a task. + */ +public class TaskExecutionInformation { + /** + * The time at which the task started running. + * 'Running' corresponds to the running state, so if the task specifies + * resource files or application packages, then the start time reflects the + * time at which the task started downloading or deploying these. If the + * task has been restarted or retried, this is the most recent time at + * which the task started running. This property is present only for tasks + * that are in the running or completed state. + */ + @JsonProperty(value = "startTime") + private DateTime startTime; + + /** + * The time at which the task completed. + * This property is set only if the task is in the Completed state. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * The exit code of the program specified on the task command line. + * This property is set only if the task is in the completed state. In + * general, the exit code for a process reflects the specific convention + * implemented by the application developer for that process. If you use + * the exit code value to make decisions in your code, be sure that you + * know the exit code convention used by the application process. However, + * if the Batch service terminates the task (due to timeout, or user + * termination via the API) you may see an operating system-defined exit + * code. + */ + @JsonProperty(value = "exitCode") + private Integer exitCode; + + /** + * Information about the container under which the task is executing. + * This property is set only if the task runs in a container context. + */ + @JsonProperty(value = "containerInfo") + private TaskContainerExecutionInformation containerInfo; + + /** + * Information describing the task failure, if any. + * This property is set only if the task is in the completed state and + * encountered a failure. + */ + @JsonProperty(value = "failureInfo") + private TaskFailureInformation failureInfo; + + /** + * The number of times the task has been retried by the Batch service. + * Task application failures (non-zero exit code) are retried, + * pre-processing errors (the task could not be run) and file upload errors + * are not retried. The Batch service will retry the task up to the limit + * specified by the constraints. + */ + @JsonProperty(value = "retryCount", required = true) + private int retryCount; + + /** + * The most recent time at which a retry of the task started running. + * This element is present only if the task was retried (i.e. retryCount is + * nonzero). If present, this is typically the same as startTime, but may + * be different if the task has been restarted for reasons other than + * retry; for example, if the compute node was rebooted during a retry, + * then the startTime is updated but the lastRetryTime is not. + */ + @JsonProperty(value = "lastRetryTime") + private DateTime lastRetryTime; + + /** + * The number of times the task has been requeued by the Batch service as + * the result of a user request. + * When the user removes nodes from a pool (by resizing/shrinking the pool) + * or when the job is being disabled, the user can specify that running + * tasks on the nodes be requeued for execution. This count tracks how many + * times the task has been requeued for these reasons. + */ + @JsonProperty(value = "requeueCount", required = true) + private int requeueCount; + + /** + * The most recent time at which the task has been requeued by the Batch + * service as the result of a user request. + * This property is set only if the requeueCount is nonzero. + */ + @JsonProperty(value = "lastRequeueTime") + private DateTime lastRequeueTime; + + /** + * The result of the task execution. + * If the value is 'failed', then the details of the failure can be found + * in the failureInfo property. Possible values include: 'success', + * 'failure'. + */ + @JsonProperty(value = "result") + private TaskExecutionResult result; + + /** + * Get 'Running' corresponds to the running state, so if the task specifies resource files or application packages, then the start time reflects the time at which the task started downloading or deploying these. If the task has been restarted or retried, this is the most recent time at which the task started running. This property is present only for tasks that are in the running or completed state. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set 'Running' corresponds to the running state, so if the task specifies resource files or application packages, then the start time reflects the time at which the task started downloading or deploying these. If the task has been restarted or retried, this is the most recent time at which the task started running. This property is present only for tasks that are in the running or completed state. + * + * @param startTime the startTime value to set + * @return the TaskExecutionInformation object itself. + */ + public TaskExecutionInformation withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get this property is set only if the task is in the Completed state. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set this property is set only if the task is in the Completed state. + * + * @param endTime the endTime value to set + * @return the TaskExecutionInformation object itself. + */ + public TaskExecutionInformation withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get this property is set only if the task is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the task (due to timeout, or user termination via the API) you may see an operating system-defined exit code. + * + * @return the exitCode value + */ + public Integer exitCode() { + return this.exitCode; + } + + /** + * Set this property is set only if the task is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the task (due to timeout, or user termination via the API) you may see an operating system-defined exit code. + * + * @param exitCode the exitCode value to set + * @return the TaskExecutionInformation object itself. + */ + public TaskExecutionInformation withExitCode(Integer exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get this property is set only if the task runs in a container context. + * + * @return the containerInfo value + */ + public TaskContainerExecutionInformation containerInfo() { + return this.containerInfo; + } + + /** + * Set this property is set only if the task runs in a container context. + * + * @param containerInfo the containerInfo value to set + * @return the TaskExecutionInformation object itself. + */ + public TaskExecutionInformation withContainerInfo(TaskContainerExecutionInformation containerInfo) { + this.containerInfo = containerInfo; + return this; + } + + /** + * Get this property is set only if the task is in the completed state and encountered a failure. + * + * @return the failureInfo value + */ + public TaskFailureInformation failureInfo() { + return this.failureInfo; + } + + /** + * Set this property is set only if the task is in the completed state and encountered a failure. + * + * @param failureInfo the failureInfo value to set + * @return the TaskExecutionInformation object itself. + */ + public TaskExecutionInformation withFailureInfo(TaskFailureInformation failureInfo) { + this.failureInfo = failureInfo; + return this; + } + + /** + * Get task application failures (non-zero exit code) are retried, pre-processing errors (the task could not be run) and file upload errors are not retried. The Batch service will retry the task up to the limit specified by the constraints. + * + * @return the retryCount value + */ + public int retryCount() { + return this.retryCount; + } + + /** + * Set task application failures (non-zero exit code) are retried, pre-processing errors (the task could not be run) and file upload errors are not retried. The Batch service will retry the task up to the limit specified by the constraints. + * + * @param retryCount the retryCount value to set + * @return the TaskExecutionInformation object itself. + */ + public TaskExecutionInformation withRetryCount(int retryCount) { + this.retryCount = retryCount; + return this; + } + + /** + * Get this element is present only if the task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the task has been restarted for reasons other than retry; for example, if the compute node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not. + * + * @return the lastRetryTime value + */ + public DateTime lastRetryTime() { + return this.lastRetryTime; + } + + /** + * Set this element is present only if the task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the task has been restarted for reasons other than retry; for example, if the compute node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not. + * + * @param lastRetryTime the lastRetryTime value to set + * @return the TaskExecutionInformation object itself. + */ + public TaskExecutionInformation withLastRetryTime(DateTime lastRetryTime) { + this.lastRetryTime = lastRetryTime; + return this; + } + + /** + * Get when the user removes nodes from a pool (by resizing/shrinking the pool) or when the job is being disabled, the user can specify that running tasks on the nodes be requeued for execution. This count tracks how many times the task has been requeued for these reasons. + * + * @return the requeueCount value + */ + public int requeueCount() { + return this.requeueCount; + } + + /** + * Set when the user removes nodes from a pool (by resizing/shrinking the pool) or when the job is being disabled, the user can specify that running tasks on the nodes be requeued for execution. This count tracks how many times the task has been requeued for these reasons. + * + * @param requeueCount the requeueCount value to set + * @return the TaskExecutionInformation object itself. + */ + public TaskExecutionInformation withRequeueCount(int requeueCount) { + this.requeueCount = requeueCount; + return this; + } + + /** + * Get this property is set only if the requeueCount is nonzero. + * + * @return the lastRequeueTime value + */ + public DateTime lastRequeueTime() { + return this.lastRequeueTime; + } + + /** + * Set this property is set only if the requeueCount is nonzero. + * + * @param lastRequeueTime the lastRequeueTime value to set + * @return the TaskExecutionInformation object itself. + */ + public TaskExecutionInformation withLastRequeueTime(DateTime lastRequeueTime) { + this.lastRequeueTime = lastRequeueTime; + return this; + } + + /** + * Get if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'. + * + * @return the result value + */ + public TaskExecutionResult result() { + return this.result; + } + + /** + * Set if the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'success', 'failure'. + * + * @param result the result value to set + * @return the TaskExecutionInformation object itself. + */ + public TaskExecutionInformation withResult(TaskExecutionResult result) { + this.result = result; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskExecutionResult.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskExecutionResult.java new file mode 100644 index 000000000000..ab5fdb3fb7f7 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskExecutionResult.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TaskExecutionResult. + */ +public enum TaskExecutionResult { + /** The task ran successfully. */ + SUCCESS("success"), + + /** There was an error during processing of the task. The failure may have occurred before the task process was launched, while the task process was executing, or after the task process exited. */ + FAILURE("failure"); + + /** The actual serialized value for a TaskExecutionResult instance. */ + private String value; + + TaskExecutionResult(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TaskExecutionResult instance. + * + * @param value the serialized value to parse. + * @return the parsed TaskExecutionResult object, or null if unable to parse. + */ + @JsonCreator + public static TaskExecutionResult fromString(String value) { + TaskExecutionResult[] items = TaskExecutionResult.values(); + for (TaskExecutionResult item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskFailureInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskFailureInformation.java new file mode 100644 index 000000000000..d0a4a8d967f9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskFailureInformation.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a task failure. + */ +public class TaskFailureInformation { + /** + * The category of the task error. + * Possible values include: 'userError', 'serverError'. + */ + @JsonProperty(value = "category", required = true) + private ErrorCategory category; + + /** + * An identifier for the task error. Codes are invariant and are intended + * to be consumed programmatically. + */ + @JsonProperty(value = "code") + private String code; + + /** + * A message describing the task error, intended to be suitable for display + * in a user interface. + */ + @JsonProperty(value = "message") + private String message; + + /** + * A list of additional details related to the error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get possible values include: 'userError', 'serverError'. + * + * @return the category value + */ + public ErrorCategory category() { + return this.category; + } + + /** + * Set possible values include: 'userError', 'serverError'. + * + * @param category the category value to set + * @return the TaskFailureInformation object itself. + */ + public TaskFailureInformation withCategory(ErrorCategory category) { + this.category = category; + return this; + } + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the TaskFailureInformation object itself. + */ + public TaskFailureInformation withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the TaskFailureInformation object itself. + */ + public TaskFailureInformation withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the details value. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set the details value. + * + * @param details the details value to set + * @return the TaskFailureInformation object itself. + */ + public TaskFailureInformation withDetails(List details) { + this.details = details; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskGetHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskGetHeaders.java new file mode 100644 index 000000000000..d56a2d33df88 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskGetHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class TaskGetHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskGetHeaders object itself. + */ + public TaskGetHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the TaskGetHeaders object itself. + */ + public TaskGetHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the TaskGetHeaders object itself. + */ + public TaskGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the TaskGetHeaders object itself. + */ + public TaskGetHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the TaskGetHeaders object itself. + */ + public TaskGetHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskGetOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskGetOptions.java new file mode 100644 index 000000000000..74cfc31a1bd1 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskGetOptions.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for get operation. + */ +public class TaskGetOptions { + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * An OData $expand clause. + */ + @JsonProperty(value = "") + private String expand; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the TaskGetOptions object itself. + */ + public TaskGetOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get an OData $expand clause. + * + * @return the expand value + */ + public String expand() { + return this.expand; + } + + /** + * Set an OData $expand clause. + * + * @param expand the expand value to set + * @return the TaskGetOptions object itself. + */ + public TaskGetOptions withExpand(String expand) { + this.expand = expand; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the TaskGetOptions object itself. + */ + public TaskGetOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskGetOptions object itself. + */ + public TaskGetOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the TaskGetOptions object itself. + */ + public TaskGetOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the TaskGetOptions object itself. + */ + public TaskGetOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the TaskGetOptions object itself. + */ + public TaskGetOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the TaskGetOptions object itself. + */ + public TaskGetOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the TaskGetOptions object itself. + */ + public TaskGetOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the TaskGetOptions object itself. + */ + public TaskGetOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskIdRange.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskIdRange.java new file mode 100644 index 000000000000..d1a114dbbde2 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskIdRange.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A range of task IDs that a task can depend on. All tasks with IDs in the + * range must complete successfully before the dependent task can be scheduled. + * The start and end of the range are inclusive. For example, if a range has + * start 9 and end 12, then it represents tasks '9', '10', '11' and '12'. + */ +public class TaskIdRange { + /** + * The first task ID in the range. + */ + @JsonProperty(value = "start", required = true) + private int start; + + /** + * The last task ID in the range. + */ + @JsonProperty(value = "end", required = true) + private int end; + + /** + * Get the start value. + * + * @return the start value + */ + public int start() { + return this.start; + } + + /** + * Set the start value. + * + * @param start the start value to set + * @return the TaskIdRange object itself. + */ + public TaskIdRange withStart(int start) { + this.start = start; + return this; + } + + /** + * Get the end value. + * + * @return the end value + */ + public int end() { + return this.end; + } + + /** + * Set the end value. + * + * @param end the end value to set + * @return the TaskIdRange object itself. + */ + public TaskIdRange withEnd(int end) { + this.end = end; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskInformation.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskInformation.java new file mode 100644 index 000000000000..2df2ba9a6e6d --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskInformation.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a task running on a compute node. + */ +public class TaskInformation { + /** + * The URL of the task. + */ + @JsonProperty(value = "taskUrl") + private String taskUrl; + + /** + * The ID of the job to which the task belongs. + */ + @JsonProperty(value = "jobId") + private String jobId; + + /** + * The ID of the task. + */ + @JsonProperty(value = "taskId") + private String taskId; + + /** + * The ID of the subtask if the task is a multi-instance task. + */ + @JsonProperty(value = "subtaskId") + private Integer subtaskId; + + /** + * The current state of the task. + * Possible values include: 'active', 'preparing', 'running', 'completed'. + */ + @JsonProperty(value = "taskState", required = true) + private TaskState taskState; + + /** + * Information about the execution of the task. + */ + @JsonProperty(value = "executionInfo") + private TaskExecutionInformation executionInfo; + + /** + * Get the taskUrl value. + * + * @return the taskUrl value + */ + public String taskUrl() { + return this.taskUrl; + } + + /** + * Set the taskUrl value. + * + * @param taskUrl the taskUrl value to set + * @return the TaskInformation object itself. + */ + public TaskInformation withTaskUrl(String taskUrl) { + this.taskUrl = taskUrl; + return this; + } + + /** + * Get the jobId value. + * + * @return the jobId value + */ + public String jobId() { + return this.jobId; + } + + /** + * Set the jobId value. + * + * @param jobId the jobId value to set + * @return the TaskInformation object itself. + */ + public TaskInformation withJobId(String jobId) { + this.jobId = jobId; + return this; + } + + /** + * Get the taskId value. + * + * @return the taskId value + */ + public String taskId() { + return this.taskId; + } + + /** + * Set the taskId value. + * + * @param taskId the taskId value to set + * @return the TaskInformation object itself. + */ + public TaskInformation withTaskId(String taskId) { + this.taskId = taskId; + return this; + } + + /** + * Get the subtaskId value. + * + * @return the subtaskId value + */ + public Integer subtaskId() { + return this.subtaskId; + } + + /** + * Set the subtaskId value. + * + * @param subtaskId the subtaskId value to set + * @return the TaskInformation object itself. + */ + public TaskInformation withSubtaskId(Integer subtaskId) { + this.subtaskId = subtaskId; + return this; + } + + /** + * Get possible values include: 'active', 'preparing', 'running', 'completed'. + * + * @return the taskState value + */ + public TaskState taskState() { + return this.taskState; + } + + /** + * Set possible values include: 'active', 'preparing', 'running', 'completed'. + * + * @param taskState the taskState value to set + * @return the TaskInformation object itself. + */ + public TaskInformation withTaskState(TaskState taskState) { + this.taskState = taskState; + return this; + } + + /** + * Get the executionInfo value. + * + * @return the executionInfo value + */ + public TaskExecutionInformation executionInfo() { + return this.executionInfo; + } + + /** + * Set the executionInfo value. + * + * @param executionInfo the executionInfo value to set + * @return the TaskInformation object itself. + */ + public TaskInformation withExecutionInfo(TaskExecutionInformation executionInfo) { + this.executionInfo = executionInfo; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListHeaders.java new file mode 100644 index 000000000000..3e86dc9e572e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for List operation. + */ +public class TaskListHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskListHeaders object itself. + */ + public TaskListHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the TaskListHeaders object itself. + */ + public TaskListHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the TaskListHeaders object itself. + */ + public TaskListHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the TaskListHeaders object itself. + */ + public TaskListHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListNextOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListNextOptions.java new file mode 100644 index 000000000000..96cf013bba05 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListNextOptions.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listNext operation. + */ +public class TaskListNextOptions { + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskListNextOptions object itself. + */ + public TaskListNextOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the TaskListNextOptions object itself. + */ + public TaskListNextOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the TaskListNextOptions object itself. + */ + public TaskListNextOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListOptions.java new file mode 100644 index 000000000000..381675abd839 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListOptions.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for list operation. + */ +public class TaskListOptions { + /** + * An OData $filter clause. For more information on constructing this + * filter, see + * https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-tasks. + */ + @JsonProperty(value = "") + private String filter; + + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * An OData $expand clause. + */ + @JsonProperty(value = "") + private String expand; + + /** + * The maximum number of items to return in the response. A maximum of 1000 + * tasks can be returned. + */ + @JsonProperty(value = "") + private Integer maxResults; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-tasks. + * + * @return the filter value + */ + public String filter() { + return this.filter; + } + + /** + * Set an OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-tasks. + * + * @param filter the filter value to set + * @return the TaskListOptions object itself. + */ + public TaskListOptions withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the TaskListOptions object itself. + */ + public TaskListOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get an OData $expand clause. + * + * @return the expand value + */ + public String expand() { + return this.expand; + } + + /** + * Set an OData $expand clause. + * + * @param expand the expand value to set + * @return the TaskListOptions object itself. + */ + public TaskListOptions withExpand(String expand) { + this.expand = expand; + return this; + } + + /** + * Get the maximum number of items to return in the response. A maximum of 1000 tasks can be returned. + * + * @return the maxResults value + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maximum number of items to return in the response. A maximum of 1000 tasks can be returned. + * + * @param maxResults the maxResults value to set + * @return the TaskListOptions object itself. + */ + public TaskListOptions withMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the TaskListOptions object itself. + */ + public TaskListOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskListOptions object itself. + */ + public TaskListOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the TaskListOptions object itself. + */ + public TaskListOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the TaskListOptions object itself. + */ + public TaskListOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListSubtasksHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListSubtasksHeaders.java new file mode 100644 index 000000000000..32961bc7092c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListSubtasksHeaders.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for ListSubtasks operation. + */ +public class TaskListSubtasksHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskListSubtasksHeaders object itself. + */ + public TaskListSubtasksHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the TaskListSubtasksHeaders object itself. + */ + public TaskListSubtasksHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the TaskListSubtasksHeaders object itself. + */ + public TaskListSubtasksHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the TaskListSubtasksHeaders object itself. + */ + public TaskListSubtasksHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListSubtasksOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListSubtasksOptions.java new file mode 100644 index 000000000000..04de4278218e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskListSubtasksOptions.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for listSubtasks operation. + */ +public class TaskListSubtasksOptions { + /** + * An OData $select clause. + */ + @JsonProperty(value = "") + private String select; + + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * Get an OData $select clause. + * + * @return the select value + */ + public String select() { + return this.select; + } + + /** + * Set an OData $select clause. + * + * @param select the select value to set + * @return the TaskListSubtasksOptions object itself. + */ + public TaskListSubtasksOptions withSelect(String select) { + this.select = select; + return this; + } + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the TaskListSubtasksOptions object itself. + */ + public TaskListSubtasksOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskListSubtasksOptions object itself. + */ + public TaskListSubtasksOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the TaskListSubtasksOptions object itself. + */ + public TaskListSubtasksOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the TaskListSubtasksOptions object itself. + */ + public TaskListSubtasksOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskReactivateHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskReactivateHeaders.java new file mode 100644 index 000000000000..d87ff93363e3 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskReactivateHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Reactivate operation. + */ +public class TaskReactivateHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskReactivateHeaders object itself. + */ + public TaskReactivateHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the TaskReactivateHeaders object itself. + */ + public TaskReactivateHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the TaskReactivateHeaders object itself. + */ + public TaskReactivateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the TaskReactivateHeaders object itself. + */ + public TaskReactivateHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the TaskReactivateHeaders object itself. + */ + public TaskReactivateHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskReactivateOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskReactivateOptions.java new file mode 100644 index 000000000000..9b09271423a5 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskReactivateOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for reactivate operation. + */ +public class TaskReactivateOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the TaskReactivateOptions object itself. + */ + public TaskReactivateOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskReactivateOptions object itself. + */ + public TaskReactivateOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the TaskReactivateOptions object itself. + */ + public TaskReactivateOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the TaskReactivateOptions object itself. + */ + public TaskReactivateOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the TaskReactivateOptions object itself. + */ + public TaskReactivateOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the TaskReactivateOptions object itself. + */ + public TaskReactivateOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the TaskReactivateOptions object itself. + */ + public TaskReactivateOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the TaskReactivateOptions object itself. + */ + public TaskReactivateOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskSchedulingPolicy.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskSchedulingPolicy.java new file mode 100644 index 000000000000..5c5b9a952078 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskSchedulingPolicy.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies how tasks should be distributed across compute nodes. + */ +public class TaskSchedulingPolicy { + /** + * How tasks are distributed across compute nodes in a pool. + * Possible values include: 'spread', 'pack'. + */ + @JsonProperty(value = "nodeFillType", required = true) + private ComputeNodeFillType nodeFillType; + + /** + * Get possible values include: 'spread', 'pack'. + * + * @return the nodeFillType value + */ + public ComputeNodeFillType nodeFillType() { + return this.nodeFillType; + } + + /** + * Set possible values include: 'spread', 'pack'. + * + * @param nodeFillType the nodeFillType value to set + * @return the TaskSchedulingPolicy object itself. + */ + public TaskSchedulingPolicy withNodeFillType(ComputeNodeFillType nodeFillType) { + this.nodeFillType = nodeFillType; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskState.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskState.java new file mode 100644 index 000000000000..ae769ba579b9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskState.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TaskState. + */ +public enum TaskState { + /** The task is queued and able to run, but is not currently assigned to a compute node. A task enters this state when it is created, when it is enabled after being disabled, or when it is awaiting a retry after a failed run. */ + ACTIVE("active"), + + /** The task has been assigned to a compute node, but is waiting for a required Job Preparation task to complete on the node. If the Job Preparation task succeeds, the task will move to running. If the Job Preparation task fails, the task will return to active and will be eligible to be assigned to a different node. */ + PREPARING("preparing"), + + /** The task is running on a compute node. This includes task-level preparation such as downloading resource files or deploying application packages specified on the task - it does not necessarily mean that the task command line has started executing. */ + RUNNING("running"), + + /** The task is no longer eligible to run, usually because the task has finished successfully, or the task has finished unsuccessfully and has exhausted its retry limit. A task is also marked as completed if an error occurred launching the task, or when the task has been terminated. */ + COMPLETED("completed"); + + /** The actual serialized value for a TaskState instance. */ + private String value; + + TaskState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TaskState instance. + * + * @param value the serialized value to parse. + * @return the parsed TaskState object, or null if unable to parse. + */ + @JsonCreator + public static TaskState fromString(String value) { + TaskState[] items = TaskState.values(); + for (TaskState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskStatistics.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskStatistics.java new file mode 100644 index 000000000000..7baeb2698cfc --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskStatistics.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource usage statistics for a task. + */ +public class TaskStatistics { + /** + * The URL of the statistics. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * The start time of the time range covered by the statistics. + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The time at which the statistics were last updated. All statistics are + * limited to the range between startTime and lastUpdateTime. + */ + @JsonProperty(value = "lastUpdateTime", required = true) + private DateTime lastUpdateTime; + + /** + * The total user mode CPU time (summed across all cores and all compute + * nodes) consumed by the task. + */ + @JsonProperty(value = "userCPUTime", required = true) + private Period userCPUTime; + + /** + * The total kernel mode CPU time (summed across all cores and all compute + * nodes) consumed by the task. + */ + @JsonProperty(value = "kernelCPUTime", required = true) + private Period kernelCPUTime; + + /** + * The total wall clock time of the task. + * The wall clock time is the elapsed time from when the task started + * running on a compute node to when it finished (or to the last time the + * statistics were updated, if the task had not finished by then). If the + * task was retried, this includes the wall clock time of all the task + * retries. + */ + @JsonProperty(value = "wallClockTime", required = true) + private Period wallClockTime; + + /** + * The total number of disk read operations made by the task. + */ + @JsonProperty(value = "readIOps", required = true) + private long readIOps; + + /** + * The total number of disk write operations made by the task. + */ + @JsonProperty(value = "writeIOps", required = true) + private long writeIOps; + + /** + * The total gibibytes read from disk by the task. + */ + @JsonProperty(value = "readIOGiB", required = true) + private double readIOGiB; + + /** + * The total gibibytes written to disk by the task. + */ + @JsonProperty(value = "writeIOGiB", required = true) + private double writeIOGiB; + + /** + * The total wait time of the task. The wait time for a task is defined as + * the elapsed time between the creation of the task and the start of task + * execution. (If the task is retried due to failures, the wait time is the + * time to the most recent task execution.). + */ + @JsonProperty(value = "waitTime", required = true) + private Period waitTime; + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the TaskStatistics object itself. + */ + public TaskStatistics withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime value. + * + * @param startTime the startTime value to set + * @return the TaskStatistics object itself. + */ + public TaskStatistics withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the lastUpdateTime value. + * + * @return the lastUpdateTime value + */ + public DateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime value. + * + * @param lastUpdateTime the lastUpdateTime value to set + * @return the TaskStatistics object itself. + */ + public TaskStatistics withLastUpdateTime(DateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the userCPUTime value. + * + * @return the userCPUTime value + */ + public Period userCPUTime() { + return this.userCPUTime; + } + + /** + * Set the userCPUTime value. + * + * @param userCPUTime the userCPUTime value to set + * @return the TaskStatistics object itself. + */ + public TaskStatistics withUserCPUTime(Period userCPUTime) { + this.userCPUTime = userCPUTime; + return this; + } + + /** + * Get the kernelCPUTime value. + * + * @return the kernelCPUTime value + */ + public Period kernelCPUTime() { + return this.kernelCPUTime; + } + + /** + * Set the kernelCPUTime value. + * + * @param kernelCPUTime the kernelCPUTime value to set + * @return the TaskStatistics object itself. + */ + public TaskStatistics withKernelCPUTime(Period kernelCPUTime) { + this.kernelCPUTime = kernelCPUTime; + return this; + } + + /** + * Get the wall clock time is the elapsed time from when the task started running on a compute node to when it finished (or to the last time the statistics were updated, if the task had not finished by then). If the task was retried, this includes the wall clock time of all the task retries. + * + * @return the wallClockTime value + */ + public Period wallClockTime() { + return this.wallClockTime; + } + + /** + * Set the wall clock time is the elapsed time from when the task started running on a compute node to when it finished (or to the last time the statistics were updated, if the task had not finished by then). If the task was retried, this includes the wall clock time of all the task retries. + * + * @param wallClockTime the wallClockTime value to set + * @return the TaskStatistics object itself. + */ + public TaskStatistics withWallClockTime(Period wallClockTime) { + this.wallClockTime = wallClockTime; + return this; + } + + /** + * Get the readIOps value. + * + * @return the readIOps value + */ + public long readIOps() { + return this.readIOps; + } + + /** + * Set the readIOps value. + * + * @param readIOps the readIOps value to set + * @return the TaskStatistics object itself. + */ + public TaskStatistics withReadIOps(long readIOps) { + this.readIOps = readIOps; + return this; + } + + /** + * Get the writeIOps value. + * + * @return the writeIOps value + */ + public long writeIOps() { + return this.writeIOps; + } + + /** + * Set the writeIOps value. + * + * @param writeIOps the writeIOps value to set + * @return the TaskStatistics object itself. + */ + public TaskStatistics withWriteIOps(long writeIOps) { + this.writeIOps = writeIOps; + return this; + } + + /** + * Get the readIOGiB value. + * + * @return the readIOGiB value + */ + public double readIOGiB() { + return this.readIOGiB; + } + + /** + * Set the readIOGiB value. + * + * @param readIOGiB the readIOGiB value to set + * @return the TaskStatistics object itself. + */ + public TaskStatistics withReadIOGiB(double readIOGiB) { + this.readIOGiB = readIOGiB; + return this; + } + + /** + * Get the writeIOGiB value. + * + * @return the writeIOGiB value + */ + public double writeIOGiB() { + return this.writeIOGiB; + } + + /** + * Set the writeIOGiB value. + * + * @param writeIOGiB the writeIOGiB value to set + * @return the TaskStatistics object itself. + */ + public TaskStatistics withWriteIOGiB(double writeIOGiB) { + this.writeIOGiB = writeIOGiB; + return this; + } + + /** + * Get the waitTime value. + * + * @return the waitTime value + */ + public Period waitTime() { + return this.waitTime; + } + + /** + * Set the waitTime value. + * + * @param waitTime the waitTime value to set + * @return the TaskStatistics object itself. + */ + public TaskStatistics withWaitTime(Period waitTime) { + this.waitTime = waitTime; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskTerminateHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskTerminateHeaders.java new file mode 100644 index 000000000000..47e0e4f8bb5e --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskTerminateHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Terminate operation. + */ +public class TaskTerminateHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskTerminateHeaders object itself. + */ + public TaskTerminateHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the TaskTerminateHeaders object itself. + */ + public TaskTerminateHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the TaskTerminateHeaders object itself. + */ + public TaskTerminateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the TaskTerminateHeaders object itself. + */ + public TaskTerminateHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the TaskTerminateHeaders object itself. + */ + public TaskTerminateHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskTerminateOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskTerminateOptions.java new file mode 100644 index 000000000000..d3e9b38e8fbe --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskTerminateOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for terminate operation. + */ +public class TaskTerminateOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the TaskTerminateOptions object itself. + */ + public TaskTerminateOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskTerminateOptions object itself. + */ + public TaskTerminateOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the TaskTerminateOptions object itself. + */ + public TaskTerminateOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the TaskTerminateOptions object itself. + */ + public TaskTerminateOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the TaskTerminateOptions object itself. + */ + public TaskTerminateOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the TaskTerminateOptions object itself. + */ + public TaskTerminateOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the TaskTerminateOptions object itself. + */ + public TaskTerminateOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the TaskTerminateOptions object itself. + */ + public TaskTerminateOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskUpdateHeaders.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskUpdateHeaders.java new file mode 100644 index 000000000000..af8df9c21285 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskUpdateHeaders.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Update operation. + */ +public class TaskUpdateHeaders { + /** + * The client-request-id provided by the client during the request. This + * will be returned only if the return-client-request-id parameter was set + * to true. + */ + @JsonProperty(value = "client-request-id") + private UUID clientRequestId; + + /** + * A unique identifier for the request that was made to the Batch service. + * If a request is consistently failing and you have verified that the + * request is properly formulated, you may use this value to report the + * error to Microsoft. In your report, include the value of this request + * ID, the approximate time that the request was made, the Batch account + * against which the request was made, and the region that account resides + * in. + */ + @JsonProperty(value = "request-id") + private UUID requestId; + + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Modified-Since, + * If-Unmodified-Since, If-Match or If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * The time at which the resource was last modified. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /** + * The OData ID of the resource to which the request applied. + */ + @JsonProperty(value = "DataServiceId") + private String dataServiceId; + + /** + * Get the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client-request-id provided by the client during the request. This will be returned only if the return-client-request-id parameter was set to true. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskUpdateHeaders object itself. + */ + public TaskUpdateHeaders withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Set a unique identifier for the request that was made to the Batch service. If a request is consistently failing and you have verified that the request is properly formulated, you may use this value to report the error to Microsoft. In your report, include the value of this request ID, the approximate time that the request was made, the Batch account against which the request was made, and the region that account resides in. + * + * @param requestId the requestId value to set + * @return the TaskUpdateHeaders object itself. + */ + public TaskUpdateHeaders withRequestId(UUID requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Modified-Since, If-Unmodified-Since, If-Match or If-None-Match headers. + * + * @param eTag the eTag value to set + * @return the TaskUpdateHeaders object itself. + */ + public TaskUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the time at which the resource was last modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the time at which the resource was last modified. + * + * @param lastModified the lastModified value to set + * @return the TaskUpdateHeaders object itself. + */ + public TaskUpdateHeaders withLastModified(DateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the OData ID of the resource to which the request applied. + * + * @return the dataServiceId value + */ + public String dataServiceId() { + return this.dataServiceId; + } + + /** + * Set the OData ID of the resource to which the request applied. + * + * @param dataServiceId the dataServiceId value to set + * @return the TaskUpdateHeaders object itself. + */ + public TaskUpdateHeaders withDataServiceId(String dataServiceId) { + this.dataServiceId = dataServiceId; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskUpdateOptions.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskUpdateOptions.java new file mode 100644 index 000000000000..b26ef02e7b53 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskUpdateOptions.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.UUID; +import com.microsoft.rest.DateTimeRfc1123; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for update operation. + */ +public class TaskUpdateOptions { + /** + * The maximum time that the server can spend processing the request, in + * seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * The caller-generated request identity, in the form of a GUID with no + * decoration such as curly braces, e.g. + * 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Whether the server should return the client-request-id in the response. + */ + @JsonProperty(value = "") + private Boolean returnClientRequestId; + + /** + * The time the request was issued. Client libraries typically set this to + * the current system clock time; set it explicitly if you are calling the + * REST API directly. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ocpDate; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service exactly matches the value specified by the client. + */ + @JsonProperty(value = "") + private String ifMatch; + + /** + * An ETag value associated with the version of the resource known to the + * client. The operation will be performed only if the resource's current + * ETag on the service does not match the value specified by the client. + */ + @JsonProperty(value = "") + private String ifNoneMatch; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifModifiedSince; + + /** + * A timestamp indicating the last modified time of the resource known to + * the client. The operation will be performed only if the resource on the + * service has not been modified since the specified time. + */ + @JsonProperty(value = "") + private DateTimeRfc1123 ifUnmodifiedSince; + + /** + * Get the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. + * + * @param timeout the timeout value to set + * @return the TaskUpdateOptions object itself. + */ + public TaskUpdateOptions withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param clientRequestId the clientRequestId value to set + * @return the TaskUpdateOptions object itself. + */ + public TaskUpdateOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get whether the server should return the client-request-id in the response. + * + * @return the returnClientRequestId value + */ + public Boolean returnClientRequestId() { + return this.returnClientRequestId; + } + + /** + * Set whether the server should return the client-request-id in the response. + * + * @param returnClientRequestId the returnClientRequestId value to set + * @return the TaskUpdateOptions object itself. + */ + public TaskUpdateOptions withReturnClientRequestId(Boolean returnClientRequestId) { + this.returnClientRequestId = returnClientRequestId; + return this; + } + + /** + * Get the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @return the ocpDate value + */ + public DateTime ocpDate() { + if (this.ocpDate == null) { + return null; + } + return this.ocpDate.dateTime(); + } + + /** + * Set the time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly. + * + * @param ocpDate the ocpDate value to set + * @return the TaskUpdateOptions object itself. + */ + public TaskUpdateOptions withOcpDate(DateTime ocpDate) { + if (ocpDate == null) { + this.ocpDate = null; + } else { + this.ocpDate = new DateTimeRfc1123(ocpDate); + } + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @return the ifMatch value + */ + public String ifMatch() { + return this.ifMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service exactly matches the value specified by the client. + * + * @param ifMatch the ifMatch value to set + * @return the TaskUpdateOptions object itself. + */ + public TaskUpdateOptions withIfMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Get an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @return the ifNoneMatch value + */ + public String ifNoneMatch() { + return this.ifNoneMatch; + } + + /** + * Set an ETag value associated with the version of the resource known to the client. The operation will be performed only if the resource's current ETag on the service does not match the value specified by the client. + * + * @param ifNoneMatch the ifNoneMatch value to set + * @return the TaskUpdateOptions object itself. + */ + public TaskUpdateOptions withIfNoneMatch(String ifNoneMatch) { + this.ifNoneMatch = ifNoneMatch; + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @return the ifModifiedSince value + */ + public DateTime ifModifiedSince() { + if (this.ifModifiedSince == null) { + return null; + } + return this.ifModifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has been modified since the specified time. + * + * @param ifModifiedSince the ifModifiedSince value to set + * @return the TaskUpdateOptions object itself. + */ + public TaskUpdateOptions withIfModifiedSince(DateTime ifModifiedSince) { + if (ifModifiedSince == null) { + this.ifModifiedSince = null; + } else { + this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); + } + return this; + } + + /** + * Get a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @return the ifUnmodifiedSince value + */ + public DateTime ifUnmodifiedSince() { + if (this.ifUnmodifiedSince == null) { + return null; + } + return this.ifUnmodifiedSince.dateTime(); + } + + /** + * Set a timestamp indicating the last modified time of the resource known to the client. The operation will be performed only if the resource on the service has not been modified since the specified time. + * + * @param ifUnmodifiedSince the ifUnmodifiedSince value to set + * @return the TaskUpdateOptions object itself. + */ + public TaskUpdateOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { + if (ifUnmodifiedSince == null) { + this.ifUnmodifiedSince = null; + } else { + this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); + } + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskUpdateParameter.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskUpdateParameter.java new file mode 100644 index 000000000000..a81930b03efe --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/TaskUpdateParameter.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of changes to be made to a task. + */ +public class TaskUpdateParameter { + /** + * Constraints that apply to this task. + * If omitted, the task is given the default constraints. For + * multi-instance tasks, updating the retention time applies only to the + * primary task and not subtasks. + */ + @JsonProperty(value = "constraints") + private TaskConstraints constraints; + + /** + * Get if omitted, the task is given the default constraints. For multi-instance tasks, updating the retention time applies only to the primary task and not subtasks. + * + * @return the constraints value + */ + public TaskConstraints constraints() { + return this.constraints; + } + + /** + * Set if omitted, the task is given the default constraints. For multi-instance tasks, updating the retention time applies only to the primary task and not subtasks. + * + * @param constraints the constraints value to set + * @return the TaskUpdateParameter object itself. + */ + public TaskUpdateParameter withConstraints(TaskConstraints constraints) { + this.constraints = constraints; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UploadBatchServiceLogsConfiguration.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UploadBatchServiceLogsConfiguration.java new file mode 100644 index 000000000000..cf8e08eed51c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UploadBatchServiceLogsConfiguration.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Azure Batch service log files upload configuration for a compute node. + */ +public class UploadBatchServiceLogsConfiguration { + /** + * The URL of the container within Azure Blob Storage to which to upload + * the Batch Service log file(s). + * The URL must include a Shared Access Signature (SAS) granting write + * permissions to the container. The SAS duration must allow enough time + * for the upload to finish. The start time for SAS is optional and + * recommended to not be specified. + */ + @JsonProperty(value = "containerUrl", required = true) + private String containerUrl; + + /** + * The start of the time range from which to upload Batch Service log + * file(s). + * Any log file containing a log message in the time range will be + * uploaded. This means that the operation might retrieve more logs than + * have been requested since the entire log file is always uploaded, but + * the operation should not retrieve fewer logs than have been requested. + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The end of the time range from which to upload Batch Service log + * file(s). + * Any log file containing a log message in the time range will be + * uploaded. This means that the operation might retrieve more logs than + * have been requested since the entire log file is always uploaded, but + * the operation should not retrieve fewer logs than have been requested. + * If omitted, the default is to upload all logs available after the + * startTime. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * Get the URL must include a Shared Access Signature (SAS) granting write permissions to the container. The SAS duration must allow enough time for the upload to finish. The start time for SAS is optional and recommended to not be specified. + * + * @return the containerUrl value + */ + public String containerUrl() { + return this.containerUrl; + } + + /** + * Set the URL must include a Shared Access Signature (SAS) granting write permissions to the container. The SAS duration must allow enough time for the upload to finish. The start time for SAS is optional and recommended to not be specified. + * + * @param containerUrl the containerUrl value to set + * @return the UploadBatchServiceLogsConfiguration object itself. + */ + public UploadBatchServiceLogsConfiguration withContainerUrl(String containerUrl) { + this.containerUrl = containerUrl; + return this; + } + + /** + * Get any log file containing a log message in the time range will be uploaded. This means that the operation might retrieve more logs than have been requested since the entire log file is always uploaded, but the operation should not retrieve fewer logs than have been requested. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set any log file containing a log message in the time range will be uploaded. This means that the operation might retrieve more logs than have been requested since the entire log file is always uploaded, but the operation should not retrieve fewer logs than have been requested. + * + * @param startTime the startTime value to set + * @return the UploadBatchServiceLogsConfiguration object itself. + */ + public UploadBatchServiceLogsConfiguration withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get any log file containing a log message in the time range will be uploaded. This means that the operation might retrieve more logs than have been requested since the entire log file is always uploaded, but the operation should not retrieve fewer logs than have been requested. If omitted, the default is to upload all logs available after the startTime. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set any log file containing a log message in the time range will be uploaded. This means that the operation might retrieve more logs than have been requested since the entire log file is always uploaded, but the operation should not retrieve fewer logs than have been requested. If omitted, the default is to upload all logs available after the startTime. + * + * @param endTime the endTime value to set + * @return the UploadBatchServiceLogsConfiguration object itself. + */ + public UploadBatchServiceLogsConfiguration withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UploadBatchServiceLogsResult.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UploadBatchServiceLogsResult.java new file mode 100644 index 000000000000..df9ab0354663 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UploadBatchServiceLogsResult.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result of uploading Batch service log files from a specific compute + * node. + */ +public class UploadBatchServiceLogsResult { + /** + * The virtual directory within Azure Blob Storage container to which the + * Batch Service log file(s) will be uploaded. + * The virtual directory name is part of the blob name for each log file + * uploaded, and it is built based poolId, nodeId and a unique identifier. + */ + @JsonProperty(value = "virtualDirectoryName", required = true) + private String virtualDirectoryName; + + /** + * The number of log files which will be uploaded. + */ + @JsonProperty(value = "numberOfFilesUploaded", required = true) + private int numberOfFilesUploaded; + + /** + * Get the virtual directory name is part of the blob name for each log file uploaded, and it is built based poolId, nodeId and a unique identifier. + * + * @return the virtualDirectoryName value + */ + public String virtualDirectoryName() { + return this.virtualDirectoryName; + } + + /** + * Set the virtual directory name is part of the blob name for each log file uploaded, and it is built based poolId, nodeId and a unique identifier. + * + * @param virtualDirectoryName the virtualDirectoryName value to set + * @return the UploadBatchServiceLogsResult object itself. + */ + public UploadBatchServiceLogsResult withVirtualDirectoryName(String virtualDirectoryName) { + this.virtualDirectoryName = virtualDirectoryName; + return this; + } + + /** + * Get the numberOfFilesUploaded value. + * + * @return the numberOfFilesUploaded value + */ + public int numberOfFilesUploaded() { + return this.numberOfFilesUploaded; + } + + /** + * Set the numberOfFilesUploaded value. + * + * @param numberOfFilesUploaded the numberOfFilesUploaded value to set + * @return the UploadBatchServiceLogsResult object itself. + */ + public UploadBatchServiceLogsResult withNumberOfFilesUploaded(int numberOfFilesUploaded) { + this.numberOfFilesUploaded = numberOfFilesUploaded; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UsageStatistics.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UsageStatistics.java new file mode 100644 index 000000000000..8b468629c14c --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UsageStatistics.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import org.joda.time.DateTime; +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Statistics related to pool usage information. + */ +public class UsageStatistics { + /** + * The start time of the time range covered by the statistics. + */ + @JsonProperty(value = "startTime", required = true) + private DateTime startTime; + + /** + * The time at which the statistics were last updated. All statistics are + * limited to the range between startTime and lastUpdateTime. + */ + @JsonProperty(value = "lastUpdateTime", required = true) + private DateTime lastUpdateTime; + + /** + * The aggregated wall-clock time of the dedicated compute node cores being + * part of the pool. + */ + @JsonProperty(value = "dedicatedCoreTime", required = true) + private Period dedicatedCoreTime; + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime value. + * + * @param startTime the startTime value to set + * @return the UsageStatistics object itself. + */ + public UsageStatistics withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the lastUpdateTime value. + * + * @return the lastUpdateTime value + */ + public DateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime value. + * + * @param lastUpdateTime the lastUpdateTime value to set + * @return the UsageStatistics object itself. + */ + public UsageStatistics withLastUpdateTime(DateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the dedicatedCoreTime value. + * + * @return the dedicatedCoreTime value + */ + public Period dedicatedCoreTime() { + return this.dedicatedCoreTime; + } + + /** + * Set the dedicatedCoreTime value. + * + * @param dedicatedCoreTime the dedicatedCoreTime value to set + * @return the UsageStatistics object itself. + */ + public UsageStatistics withDedicatedCoreTime(Period dedicatedCoreTime) { + this.dedicatedCoreTime = dedicatedCoreTime; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UserAccount.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UserAccount.java new file mode 100644 index 000000000000..f3f15ac7d2dc --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UserAccount.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties used to create a user used to execute tasks on an Azure Batch + * node. + */ +public class UserAccount { + /** + * The name of the user account. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The password for the user account. + */ + @JsonProperty(value = "password", required = true) + private String password; + + /** + * The elevation level of the user account. + * The default value is nonAdmin. Possible values include: 'nonAdmin', + * 'admin'. + */ + @JsonProperty(value = "elevationLevel") + private ElevationLevel elevationLevel; + + /** + * The Linux-specific user configuration for the user account. + * This property is ignored if specified on a Windows pool. If not + * specified, the user is created with the default options. + */ + @JsonProperty(value = "linuxUserConfiguration") + private LinuxUserConfiguration linuxUserConfiguration; + + /** + * The Windows-specific user configuration for the user account. + * This property can only be specified if the user is on a Windows pool. If + * not specified and on a Windows pool, the user is created with the + * default options. + */ + @JsonProperty(value = "windowsUserConfiguration") + private WindowsUserConfiguration windowsUserConfiguration; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the UserAccount object itself. + */ + public UserAccount withName(String name) { + this.name = name; + return this; + } + + /** + * Get the password value. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set the password value. + * + * @param password the password value to set + * @return the UserAccount object itself. + */ + public UserAccount withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the default value is nonAdmin. Possible values include: 'nonAdmin', 'admin'. + * + * @return the elevationLevel value + */ + public ElevationLevel elevationLevel() { + return this.elevationLevel; + } + + /** + * Set the default value is nonAdmin. Possible values include: 'nonAdmin', 'admin'. + * + * @param elevationLevel the elevationLevel value to set + * @return the UserAccount object itself. + */ + public UserAccount withElevationLevel(ElevationLevel elevationLevel) { + this.elevationLevel = elevationLevel; + return this; + } + + /** + * Get this property is ignored if specified on a Windows pool. If not specified, the user is created with the default options. + * + * @return the linuxUserConfiguration value + */ + public LinuxUserConfiguration linuxUserConfiguration() { + return this.linuxUserConfiguration; + } + + /** + * Set this property is ignored if specified on a Windows pool. If not specified, the user is created with the default options. + * + * @param linuxUserConfiguration the linuxUserConfiguration value to set + * @return the UserAccount object itself. + */ + public UserAccount withLinuxUserConfiguration(LinuxUserConfiguration linuxUserConfiguration) { + this.linuxUserConfiguration = linuxUserConfiguration; + return this; + } + + /** + * Get this property can only be specified if the user is on a Windows pool. If not specified and on a Windows pool, the user is created with the default options. + * + * @return the windowsUserConfiguration value + */ + public WindowsUserConfiguration windowsUserConfiguration() { + return this.windowsUserConfiguration; + } + + /** + * Set this property can only be specified if the user is on a Windows pool. If not specified and on a Windows pool, the user is created with the default options. + * + * @param windowsUserConfiguration the windowsUserConfiguration value to set + * @return the UserAccount object itself. + */ + public UserAccount withWindowsUserConfiguration(WindowsUserConfiguration windowsUserConfiguration) { + this.windowsUserConfiguration = windowsUserConfiguration; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UserIdentity.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UserIdentity.java new file mode 100644 index 000000000000..4b9835686fa1 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/UserIdentity.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of the user identity under which the task is run. + * Specify either the userName or autoUser property, but not both. + */ +public class UserIdentity { + /** + * The name of the user identity under which the task is run. + * The userName and autoUser properties are mutually exclusive; you must + * specify one but not both. + */ + @JsonProperty(value = "username") + private String userName; + + /** + * The auto user under which the task is run. + * The userName and autoUser properties are mutually exclusive; you must + * specify one but not both. + */ + @JsonProperty(value = "autoUser") + private AutoUserSpecification autoUser; + + /** + * Get the userName and autoUser properties are mutually exclusive; you must specify one but not both. + * + * @return the userName value + */ + public String userName() { + return this.userName; + } + + /** + * Set the userName and autoUser properties are mutually exclusive; you must specify one but not both. + * + * @param userName the userName value to set + * @return the UserIdentity object itself. + */ + public UserIdentity withUserName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get the userName and autoUser properties are mutually exclusive; you must specify one but not both. + * + * @return the autoUser value + */ + public AutoUserSpecification autoUser() { + return this.autoUser; + } + + /** + * Set the userName and autoUser properties are mutually exclusive; you must specify one but not both. + * + * @param autoUser the autoUser value to set + * @return the UserIdentity object itself. + */ + public UserIdentity withAutoUser(AutoUserSpecification autoUser) { + this.autoUser = autoUser; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/VirtualMachineConfiguration.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/VirtualMachineConfiguration.java new file mode 100644 index 000000000000..f3b1e2303c2b --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/VirtualMachineConfiguration.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The configuration for compute nodes in a pool based on the Azure Virtual + * Machines infrastructure. + */ +public class VirtualMachineConfiguration { + /** + * A reference to the Azure Virtual Machines Marketplace image or the + * custom Virtual Machine image to use. + */ + @JsonProperty(value = "imageReference", required = true) + private ImageReference imageReference; + + /** + * The SKU of the Batch node agent to be provisioned on compute nodes in + * the pool. + * The Batch node agent is a program that runs on each node in the pool, + * and provides the command-and-control interface between the node and the + * Batch service. There are different implementations of the node agent, + * known as SKUs, for different operating systems. You must specify a node + * agent SKU which matches the selected image reference. To get the list of + * supported node agent SKUs along with their list of verified image + * references, see the 'List supported node agent SKUs' operation. + */ + @JsonProperty(value = "nodeAgentSKUId", required = true) + private String nodeAgentSKUId; + + /** + * Windows operating system settings on the virtual machine. + * This property must not be specified if the imageReference property + * specifies a Linux OS image. + */ + @JsonProperty(value = "windowsConfiguration") + private WindowsConfiguration windowsConfiguration; + + /** + * The configuration for data disks attached to the comptue nodes in the + * pool. + * This property must be specified if the compute nodes in the pool need to + * have empty data disks attached to them. This cannot be updated. Each + * node gets its own disk (the disk is not a file share). Existing disks + * cannot be attached, each attached disk is empty. When the node is + * removed from the pool, the disk and all data associated with it is also + * deleted. The disk is not formatted after being attached, it must be + * formatted before use - for more information see + * https://docs.microsoft.com/en-us/azure/virtual-machines/linux/classic/attach-disk#initialize-a-new-data-disk-in-linux + * and + * https://docs.microsoft.com/en-us/azure/virtual-machines/windows/attach-disk-ps#add-an-empty-data-disk-to-a-virtual-machine. + */ + @JsonProperty(value = "dataDisks") + private List dataDisks; + + /** + * The type of on-premises license to be used when deploying the operating + * system. + * This only applies to images that contain the Windows operating system, + * and should only be used when you hold valid on-premises licenses for the + * nodes which will be deployed. If omitted, no on-premises licensing + * discount is applied. Values are: + * + * Windows_Server - The on-premises license is for Windows Server. + * Windows_Client - The on-premises license is for Windows Client. + */ + @JsonProperty(value = "licenseType") + private String licenseType; + + /** + * The container configuration for the pool. + * If specified, setup is performed on each node in the pool to allow tasks + * to run in containers. All regular tasks and job manager tasks run on + * this pool must specify the containerSettings property, and all other + * tasks may specify it. + */ + @JsonProperty(value = "containerConfiguration") + private ContainerConfiguration containerConfiguration; + + /** + * Get the imageReference value. + * + * @return the imageReference value + */ + public ImageReference imageReference() { + return this.imageReference; + } + + /** + * Set the imageReference value. + * + * @param imageReference the imageReference value to set + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withImageReference(ImageReference imageReference) { + this.imageReference = imageReference; + return this; + } + + /** + * Get the Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the 'List supported node agent SKUs' operation. + * + * @return the nodeAgentSKUId value + */ + public String nodeAgentSKUId() { + return this.nodeAgentSKUId; + } + + /** + * Set the Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the 'List supported node agent SKUs' operation. + * + * @param nodeAgentSKUId the nodeAgentSKUId value to set + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withNodeAgentSKUId(String nodeAgentSKUId) { + this.nodeAgentSKUId = nodeAgentSKUId; + return this; + } + + /** + * Get this property must not be specified if the imageReference property specifies a Linux OS image. + * + * @return the windowsConfiguration value + */ + public WindowsConfiguration windowsConfiguration() { + return this.windowsConfiguration; + } + + /** + * Set this property must not be specified if the imageReference property specifies a Linux OS image. + * + * @param windowsConfiguration the windowsConfiguration value to set + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withWindowsConfiguration(WindowsConfiguration windowsConfiguration) { + this.windowsConfiguration = windowsConfiguration; + return this; + } + + /** + * Get this property must be specified if the compute nodes in the pool need to have empty data disks attached to them. This cannot be updated. Each node gets its own disk (the disk is not a file share). Existing disks cannot be attached, each attached disk is empty. When the node is removed from the pool, the disk and all data associated with it is also deleted. The disk is not formatted after being attached, it must be formatted before use - for more information see https://docs.microsoft.com/en-us/azure/virtual-machines/linux/classic/attach-disk#initialize-a-new-data-disk-in-linux and https://docs.microsoft.com/en-us/azure/virtual-machines/windows/attach-disk-ps#add-an-empty-data-disk-to-a-virtual-machine. + * + * @return the dataDisks value + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set this property must be specified if the compute nodes in the pool need to have empty data disks attached to them. This cannot be updated. Each node gets its own disk (the disk is not a file share). Existing disks cannot be attached, each attached disk is empty. When the node is removed from the pool, the disk and all data associated with it is also deleted. The disk is not formatted after being attached, it must be formatted before use - for more information see https://docs.microsoft.com/en-us/azure/virtual-machines/linux/classic/attach-disk#initialize-a-new-data-disk-in-linux and https://docs.microsoft.com/en-us/azure/virtual-machines/windows/attach-disk-ps#add-an-empty-data-disk-to-a-virtual-machine. + * + * @param dataDisks the dataDisks value to set + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + + /** + * Get this only applies to images that contain the Windows operating system, and should only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no on-premises licensing discount is applied. Values are: + Windows_Server - The on-premises license is for Windows Server. + Windows_Client - The on-premises license is for Windows Client. + * + * @return the licenseType value + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set this only applies to images that contain the Windows operating system, and should only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no on-premises licensing discount is applied. Values are: + Windows_Server - The on-premises license is for Windows Server. + Windows_Client - The on-premises license is for Windows Client. + * + * @param licenseType the licenseType value to set + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get if specified, setup is performed on each node in the pool to allow tasks to run in containers. All regular tasks and job manager tasks run on this pool must specify the containerSettings property, and all other tasks may specify it. + * + * @return the containerConfiguration value + */ + public ContainerConfiguration containerConfiguration() { + return this.containerConfiguration; + } + + /** + * Set if specified, setup is performed on each node in the pool to allow tasks to run in containers. All regular tasks and job manager tasks run on this pool must specify the containerSettings property, and all other tasks may specify it. + * + * @param containerConfiguration the containerConfiguration value to set + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withContainerConfiguration(ContainerConfiguration containerConfiguration) { + this.containerConfiguration = containerConfiguration; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/WindowsConfiguration.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/WindowsConfiguration.java new file mode 100644 index 000000000000..cbf91a6f5e37 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/WindowsConfiguration.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Windows operating system settings to apply to the virtual machine. + */ +public class WindowsConfiguration { + /** + * Whether automatic updates are enabled on the virtual machine. + * If omitted, the default value is true. + */ + @JsonProperty(value = "enableAutomaticUpdates") + private Boolean enableAutomaticUpdates; + + /** + * Get if omitted, the default value is true. + * + * @return the enableAutomaticUpdates value + */ + public Boolean enableAutomaticUpdates() { + return this.enableAutomaticUpdates; + } + + /** + * Set if omitted, the default value is true. + * + * @param enableAutomaticUpdates the enableAutomaticUpdates value to set + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withEnableAutomaticUpdates(Boolean enableAutomaticUpdates) { + this.enableAutomaticUpdates = enableAutomaticUpdates; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/WindowsUserConfiguration.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/WindowsUserConfiguration.java new file mode 100644 index 000000000000..047aa80eb7c9 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/WindowsUserConfiguration.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.microsoft.azure.batch.protocol.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties used to create a user account on a Windows node. + */ +public class WindowsUserConfiguration { + /** + * The login mode for the user. + * The default value for VirtualMachineConfiguration pools is batch and for + * CloudServiceConfiguration pools is interactive. Possible values include: + * 'batch', 'interactive'. + */ + @JsonProperty(value = "loginMode") + private LoginMode loginMode; + + /** + * Get the default value for VirtualMachineConfiguration pools is batch and for CloudServiceConfiguration pools is interactive. Possible values include: 'batch', 'interactive'. + * + * @return the loginMode value + */ + public LoginMode loginMode() { + return this.loginMode; + } + + /** + * Set the default value for VirtualMachineConfiguration pools is batch and for CloudServiceConfiguration pools is interactive. Possible values include: 'batch', 'interactive'. + * + * @param loginMode the loginMode value to set + * @return the WindowsUserConfiguration object itself. + */ + public WindowsUserConfiguration withLoginMode(LoginMode loginMode) { + this.loginMode = loginMode; + return this; + } + +} diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/package-info.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/package-info.java new file mode 100644 index 000000000000..efe3ab226e32 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/models/package-info.java @@ -0,0 +1,11 @@ +// 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 models classes for BatchServiceClient. + * A client for issuing REST requests to the Azure Batch service. + */ +package com.microsoft.azure.batch.protocol.models; diff --git a/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/package-info.java b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/package-info.java new file mode 100644 index 000000000000..c0b4f4379c60 --- /dev/null +++ b/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +/** + * This package contains the classes for BatchServiceClient. + * A client for issuing REST requests to the Azure Batch service. + */ +package com.microsoft.azure.batch.protocol; diff --git a/batch/data-plane/src/test/java/com/microsoft/azure/batch/BatchTestBase.java b/batch/data-plane/src/test/java/com/microsoft/azure/batch/BatchTestBase.java new file mode 100644 index 000000000000..2159edfbe90f --- /dev/null +++ b/batch/data-plane/src/test/java/com/microsoft/azure/batch/BatchTestBase.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.batch.auth.BatchApplicationTokenCredentials; +import com.microsoft.azure.batch.auth.BatchCredentials; +import com.microsoft.azure.batch.auth.BatchSharedKeyCredentials; +import com.microsoft.azure.batch.protocol.models.*; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URISyntaxException; +import java.security.InvalidKeyException; +import java.util.*; + +import com.microsoft.azure.storage.CloudStorageAccount; +import com.microsoft.azure.storage.StorageCredentials; +import com.microsoft.azure.storage.StorageCredentialsAccountAndKey; +import com.microsoft.azure.storage.StorageException; +import com.microsoft.azure.storage.blob.*; +import org.junit.Assert; + +/** + * The base for batch dataplane tests. + */ +abstract class BatchTestBase { + static BatchClient batchClient; + static int MAX_LEN_ID = 64; + + public enum AuthMode { + AAD, SharedKey + } + + static void createClient(AuthMode mode) { + BatchCredentials credentials; + + if (mode == AuthMode.AAD) { + credentials = new BatchApplicationTokenCredentials(System.getenv("AZURE_BATCH_ENDPOINT"), + System.getenv("CLIENT_ID"), System.getenv("APPLICATION_SECRET"), "microsoft.onmicrosoft.com", null, + null); + } else { + credentials = new BatchSharedKeyCredentials(System.getenv("AZURE_BATCH_ENDPOINT"), + System.getenv("AZURE_BATCH_ACCOUNT"), System.getenv("AZURE_BATCH_ACCESS_KEY")); + } + batchClient = BatchClient.open(credentials); + } + + static CloudPool createIfNotExistPaaSPool(String poolId) throws Exception { + // Create a pool with 3 Small VMs + String POOL_VM_SIZE = "Small"; + int POOL_VM_COUNT = 3; + String POOL_OS_FAMILY = "4"; + String POOL_OS_VERSION = "*"; + + // 5 minutes + long POOL_STEADY_TIMEOUT_IN_SECONDS = 5 * 60 * 1000; + + // Check if pool exists + if (!batchClient.poolOperations().existsPool(poolId)) { + // Use PaaS VM with Windows + CloudServiceConfiguration configuration = new CloudServiceConfiguration(); + configuration.withOsFamily(POOL_OS_FAMILY).withOsVersion(POOL_OS_VERSION); + + List userList = new ArrayList<>(); + userList.add(new UserAccount().withName("test-user").withPassword("kt#_gahr!@aGERDXA") + .withElevationLevel(ElevationLevel.ADMIN)); + PoolAddParameter addParameter = new PoolAddParameter().withId(poolId) + .withTargetDedicatedNodes(POOL_VM_COUNT).withVmSize(POOL_VM_SIZE) + .withCloudServiceConfiguration(configuration).withUserAccounts(userList); + batchClient.poolOperations().createPool(addParameter); + } + + long startTime = System.currentTimeMillis(); + long elapsedTime = 0L; + boolean steady = false; + CloudPool pool; + + // Wait for the VM to be allocated + while (elapsedTime < POOL_STEADY_TIMEOUT_IN_SECONDS) { + pool = batchClient.poolOperations().getPool(poolId); + if (pool.allocationState() == AllocationState.STEADY) { + steady = true; + break; + } + System.out.println("wait 30 seconds for pool steady..."); + Thread.sleep(30 * 1000); + elapsedTime = (new Date()).getTime() - startTime; + } + + Assert.assertTrue("The pool did not reach a steady state in the allotted time", steady); + + return batchClient.poolOperations().getPool(poolId); + } + + static CloudPool createIfNotExistIaaSPool(String poolId) throws Exception { + // Create a pool with 3 Small VMs + String POOL_VM_SIZE = "STANDARD_A1"; + int POOL_VM_COUNT = 1; + + // 5 minutes + long POOL_STEADY_TIMEOUT_IN_SECONDS = 5 * 60 * 1000; + + // Check if pool exists + if (!batchClient.poolOperations().existsPool(poolId)) { + // Use IaaS VM with Ubuntu + ImageReference imgRef = new ImageReference().withPublisher("Canonical").withOffer("UbuntuServer") + .withSku("16.04-LTS").withVersion("latest"); + VirtualMachineConfiguration configuration = new VirtualMachineConfiguration(); + configuration.withNodeAgentSKUId("batch.node.ubuntu 16.04").withImageReference(imgRef); + + List userList = new ArrayList<>(); + userList.add(new UserAccount().withName("test-user").withPassword("kt#_gahr!@aGERDXA") + .withLinuxUserConfiguration(new LinuxUserConfiguration().withUid(5).withGid(5)) + .withElevationLevel(ElevationLevel.ADMIN)); + PoolAddParameter addParameter = new PoolAddParameter().withId(poolId) + .withTargetDedicatedNodes(POOL_VM_COUNT).withVmSize(POOL_VM_SIZE) + .withVirtualMachineConfiguration(configuration).withUserAccounts(userList); + batchClient.poolOperations().createPool(addParameter); + } + + long startTime = System.currentTimeMillis(); + long elapsedTime = 0L; + boolean steady = false; + CloudPool pool; + + // Wait for the VM to be allocated + while (elapsedTime < POOL_STEADY_TIMEOUT_IN_SECONDS) { + pool = batchClient.poolOperations().getPool(poolId); + if (pool.allocationState() == AllocationState.STEADY) { + steady = true; + break; + } + System.out.println("wait 30 seconds for pool steady..."); + Thread.sleep(30 * 1000); + elapsedTime = (new Date()).getTime() - startTime; + } + + Assert.assertTrue("The pool did not reach a steady state in the allotted time", steady); + + return batchClient.poolOperations().getPool(poolId); + } + + static String getStringIdWithUserNamePrefix(String name) { + String userName = System.getProperty("user.name"); + StringBuilder out = new StringBuilder(); + int remainingSpace = MAX_LEN_ID - name.length(); + if (remainingSpace > 0){ + if(userName.length() > remainingSpace){ + out.append(userName.substring(0,remainingSpace)); + } else { + out.append(userName); + } + out.append(name); + } else { + out.append(name.substring(0, MAX_LEN_ID)); + } + return out.toString(); + } + + static CloudBlobContainer createBlobContainer(String storageAccountName, String storageAccountKey, + String containerName) throws URISyntaxException, StorageException { + // Create storage credential from name and key + StorageCredentials credentials = new StorageCredentialsAccountAndKey(storageAccountName, storageAccountKey); + + // Create storage account + CloudStorageAccount storageAccount = new CloudStorageAccount(credentials, true); + + // Create the blob client + CloudBlobClient blobClient = storageAccount.createCloudBlobClient(); + + // Get a reference to a container. + // The container name must be lower case + return blobClient.getContainerReference(containerName); + } + + /** + * Upload file to blob container and return sas key + * + * @param container + * blob container + * @param fileName + * the file name of blob + * @param filePath + * the local file path + * @return SAS key for the uploaded file + * @throws URISyntaxException + * @throws IOException + * @throws InvalidKeyException + * @throws StorageException + */ + static String uploadFileToCloud(CloudBlobContainer container, String fileName, String filePath) + throws StorageException, URISyntaxException, IOException, InvalidKeyException { + // Create the container if it does not exist. + container.createIfNotExists(); + + // Upload file + CloudBlockBlob blob = container.getBlockBlobReference(fileName); + File source = new File(filePath); + blob.upload(new FileInputStream(source), source.length()); + + // Create policy with 1 day read permission + SharedAccessBlobPolicy policy = new SharedAccessBlobPolicy(); + EnumSet perEnumSet = EnumSet.of(SharedAccessBlobPermissions.READ); + policy.setPermissions(perEnumSet); + + Calendar c = Calendar.getInstance(); + c.setTime(new Date()); + c.add(Calendar.DATE, 1); + policy.setSharedAccessExpiryTime(c.getTime()); + + // Create SAS key + String sas = blob.generateSharedAccessSignature(policy, null); + return blob.getUri() + "?" + sas; + } + + /** + * Wait all tasks under a specified job to be completed + * + * @param client + * batch client instance + * @param jobId + * job id + * @param expiryTimeInSeconds + * the waiting period + * @return if task completed in time, return true, otherwise, return false + * @throws BatchErrorException + * @throws IOException + * @throws InterruptedException + */ + static boolean waitForTasksToComplete(BatchClient client, String jobId, int expiryTimeInSeconds) + throws BatchErrorException, IOException, InterruptedException { + long startTime = System.currentTimeMillis(); + long elapsedTime = 0L; + + while (elapsedTime < expiryTimeInSeconds * 1000) { + List taskCollection = client.taskOperations().listTasks(jobId, + new DetailLevel.Builder().withSelectClause("id, state").build()); + + boolean allComplete = true; + for (CloudTask task : taskCollection) { + if (task.state() != TaskState.COMPLETED) { + allComplete = false; + break; + } + } + + if (allComplete) { + // All tasks completed + return true; + } + + // Check again after 10 seconds + Thread.sleep(10 * 1000); + elapsedTime = (new Date()).getTime() - startTime; + } + + // Timeout, return false + return false; + } + + static String generateContainerSasToken(CloudBlobContainer container) throws StorageException, InvalidKeyException { + container.createIfNotExists(); + + // Create policy with 1 day read permission + SharedAccessBlobPolicy policy = new SharedAccessBlobPolicy(); + EnumSet perEnumSet = EnumSet.of(SharedAccessBlobPermissions.WRITE, + SharedAccessBlobPermissions.READ, SharedAccessBlobPermissions.CREATE, SharedAccessBlobPermissions.LIST, + SharedAccessBlobPermissions.DELETE); + policy.setPermissions(perEnumSet); + + Calendar c = Calendar.getInstance(); + c.setTime(new Date()); + c.add(Calendar.DATE, 1); + policy.setSharedAccessExpiryTime(c.getTime()); + + // Create SAS key + String sas = container.generateSharedAccessSignature(policy, null); + return container.getUri() + "?" + sas; + } + + static String getContentFromContainer(CloudBlobContainer container, String fileName) + throws URISyntaxException, StorageException, IOException { + CloudBlockBlob blockBlobReference = container.getBlockBlobReference(fileName); + String s = blockBlobReference.downloadText(); + return s; + } + + static String getTestMode(){ + String testMode = System.getenv("AZURE_TEST_MODE"); + testMode = testMode != null ? testMode : ""; + return testMode; + } +} diff --git a/batch/data-plane/src/test/java/com/microsoft/azure/batch/FileTests.java b/batch/data-plane/src/test/java/com/microsoft/azure/batch/FileTests.java new file mode 100644 index 000000000000..da4deca312e8 --- /dev/null +++ b/batch/data-plane/src/test/java/com/microsoft/azure/batch/FileTests.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.batch.protocol.models.*; +import org.junit.*; +import org.apache.commons.io.IOUtils; +import rx.exceptions.Exceptions; +import rx.functions.Func1; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeoutException; + +public class FileTests extends BatchTestBase { + private static CloudPool livePool; + + @BeforeClass + public static void setup() throws Exception { + String testMode = getTestMode(); + Assume.assumeTrue("Tests only run in Record/Live mode", testMode.equals("RECORD")); + createClient(AuthMode.SharedKey); + String poolId = getStringIdWithUserNamePrefix("-testpool"); + livePool = createIfNotExistPaaSPool(poolId); + Assert.assertNotNull(livePool); + } + + @AfterClass + public static void cleanup() throws Exception { + try { + //batchClient.poolOperations().deletePool(livePool.id()); + } + catch (Exception e) { + // ignore any clean up exception + } + } + + @Test + public void canReadFromTaskFile() throws Exception { + // CREATE + String jobId = getStringIdWithUserNamePrefix("-Job-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + String taskId = "mytask"; + int TASK_COMPLETE_TIMEOUT_IN_SECONDS = 60; // 60 seconds timeout + + try { + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(livePool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + TaskAddParameter taskToAdd = new TaskAddParameter(); + taskToAdd.withId(taskId) + .withCommandLine("cmd /c echo hello"); + batchClient.taskOperations().createTask(jobId, taskToAdd); + + if (waitForTasksToComplete(batchClient, jobId, TASK_COMPLETE_TIMEOUT_IN_SECONDS)) { + List files = batchClient.fileOperations().listFilesFromTask(jobId, taskId); + boolean found = false; + for (NodeFile f : files) { + if (f.name().equals("stdout.txt")) { + found = true; + break; + } + } + Assert.assertTrue(found); + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + batchClient.fileOperations().getFileFromTask(jobId, taskId, "stdout.txt", stream); + String fileContent = stream.toString("UTF-8"); + Assert.assertEquals("hello\r\n", fileContent); + stream.close(); + + String output = batchClient.protocolLayer().files().getFromTaskAsync(jobId, taskId, "stdout.txt").map(new Func1() { + @Override + public String call(InputStream input) { + try { + return IOUtils.toString(input, "UTF-8"); + } catch (IOException e) { + throw Exceptions.propagate(e); + } + } + }).toBlocking().single(); + Assert.assertEquals("hello\r\n", output); + + FileProperties properties = batchClient.fileOperations().getFilePropertiesFromTask(jobId, taskId, "stdout.txt"); + Assert.assertEquals(7, properties.contentLength()); + } else { + throw new TimeoutException("Task did not complete within the specified timeout"); + } + } + finally { + try { + batchClient.jobOperations().deleteJob(jobId); + } + catch (Exception e) { + // Ignore here + } + } + } + + @Test + public void canReadFromNode() throws Exception { + // CREATE + String jobId = getStringIdWithUserNamePrefix("-Job-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + String taskId = "mytask"; + int TASK_COMPLETE_TIMEOUT_IN_SECONDS = 60; // 60 seconds timeout + + try { + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(livePool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + + TaskAddParameter taskToAdd = new TaskAddParameter(); + taskToAdd.withId(taskId) + .withCommandLine("cmd /c echo hello"); + batchClient.taskOperations().createTask(jobId, taskToAdd); + + if (waitForTasksToComplete(batchClient, jobId, TASK_COMPLETE_TIMEOUT_IN_SECONDS)) { + CloudTask task = batchClient.taskOperations().getTask(jobId, taskId); + String nodeId = task.nodeInfo().nodeId(); + + List files = batchClient.fileOperations().listFilesFromComputeNode(livePool.id(), nodeId, true, null); + String fileName = null; + for (NodeFile f : files) { + if (f.name().endsWith("stdout.txt")) { + fileName = f.name(); + break; + } + } + Assert.assertNotNull(fileName); + + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + batchClient.fileOperations().getFileFromComputeNode(livePool.id(), nodeId, fileName, stream); + String fileContent = stream.toString("UTF-8"); + Assert.assertEquals("hello\r\n", fileContent); + stream.close(); + + String output = batchClient.protocolLayer().files().getFromComputeNodeAsync(livePool.id(), nodeId, fileName).map(new Func1() { + @Override + public String call(InputStream input) { + try { + return IOUtils.toString(input, "UTF-8"); + } catch (IOException e) { + throw Exceptions.propagate(e); + } + } + }).toBlocking().single(); + Assert.assertEquals("hello\r\n", output); + + FileProperties properties = batchClient.fileOperations().getFilePropertiesFromComputeNode(livePool.id(), nodeId, fileName); + Assert.assertEquals(7, properties.contentLength()); + } else { + throw new TimeoutException("Task did not complete within the specified timeout"); + } + } + finally { + try { + batchClient.jobOperations().deleteJob(jobId); + } + catch (Exception e) { + // Ignore here + } + } + } +} diff --git a/batch/data-plane/src/test/java/com/microsoft/azure/batch/JobScheduleTests.java b/batch/data-plane/src/test/java/com/microsoft/azure/batch/JobScheduleTests.java new file mode 100644 index 000000000000..d803fc204ea3 --- /dev/null +++ b/batch/data-plane/src/test/java/com/microsoft/azure/batch/JobScheduleTests.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.batch.protocol.models.*; +import org.joda.time.DateTime; +import org.joda.time.Period; +import org.junit.*; + +import java.util.Date; +import java.util.LinkedList; +import java.util.List; + +public class JobScheduleTests extends BatchTestBase { + static CloudPool livePool; + + @BeforeClass + public static void setup() throws Exception { + String testMode = getTestMode(); + Assume.assumeTrue("Tests only run in Record/Live mode", testMode.equals("RECORD")); + createClient(AuthMode.SharedKey); + String poolId = getStringIdWithUserNamePrefix("-testpool"); + livePool = createIfNotExistPaaSPool(poolId); + Assert.assertNotNull(livePool); + } + + @AfterClass + public static void cleanup() throws Exception { + try { + //batchClient.poolOperations().deletePool(livePool.id()); + } + catch (Exception e) { + // ignore any clean up exception + } + } + + @Test + public void canCRUDJobSchedule() throws Exception { + // CREATE + String jobScheduleId = getStringIdWithUserNamePrefix("-JobSchedule-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(livePool.id()); + Schedule schedule = new Schedule().withDoNotRunUntil(DateTime.now()).withDoNotRunAfter(DateTime.now().plusHours(5)).withStartWindow(Period.days(5)); + JobSpecification spec = new JobSpecification().withPriority(100).withPoolInfo(poolInfo); + batchClient.jobScheduleOperations().createJobSchedule(jobScheduleId, schedule, spec); + + try { + // GET + Assert.assertTrue(batchClient.jobScheduleOperations().existsJobSchedule(jobScheduleId)); + + CloudJobSchedule jobSchedule = batchClient.jobScheduleOperations().getJobSchedule(jobScheduleId); + Assert.assertNotNull(jobSchedule); + Assert.assertEquals(jobScheduleId, jobSchedule.id()); + Assert.assertEquals((Integer) 100, jobSchedule.jobSpecification().priority()); + Assert.assertTrue(jobSchedule.schedule().doNotRunAfter().compareTo(DateTime.now()) > 0); + + // LIST + List jobSchedules = batchClient.jobScheduleOperations().listJobSchedules(new DetailLevel.Builder().withFilterClause(String.format("id eq '%s'", jobScheduleId)).build()); + Assert.assertNotNull(jobSchedules); + Assert.assertTrue(jobSchedules.size() > 0); + + Assert.assertEquals(jobScheduleId, jobSchedules.get(0).id()); + + // UPDATE + LinkedList metadata = new LinkedList(); + metadata.add((new MetadataItem()).withName("key1").withValue("value1")); + batchClient.jobScheduleOperations().patchJobSchedule(jobScheduleId, null, null, metadata); + jobSchedule = batchClient.jobScheduleOperations().getJobSchedule(jobScheduleId); + Assert.assertTrue(jobSchedule.metadata().size() == 1); + Assert.assertTrue(jobSchedule.metadata().get(0).name().equals("key1")); + Assert.assertEquals((Integer) 100, jobSchedule.jobSpecification().priority()); + + // DELETE + batchClient.jobScheduleOperations().deleteJobSchedule(jobScheduleId); + try { + jobSchedule = batchClient.jobScheduleOperations().getJobSchedule(jobScheduleId); + Assert.assertTrue("Shouldn't be here, the jobschedule should be deleted", true); + } catch (BatchErrorException err) { + if (!err.body().code().equals(BatchErrorCodeStrings.JobScheduleNotFound)) { + throw err; + } + } + + Thread.sleep(1000); + } finally { + try { + batchClient.jobScheduleOperations().deleteJobSchedule(jobScheduleId); + } catch (Exception e) { + // Ignore here + } + } + } + + @Test + public void canUpdateJobScheduleState() throws Exception { + // CREATE + String jobScheduleId = getStringIdWithUserNamePrefix("-JobSchedule-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(livePool.id()); + JobSpecification spec = new JobSpecification().withPriority(100).withPoolInfo(poolInfo); + Schedule schedule = new Schedule().withDoNotRunUntil(DateTime.now()).withDoNotRunAfter(DateTime.now().plusHours(5)).withStartWindow(Period.days(5)); + batchClient.jobScheduleOperations().createJobSchedule(jobScheduleId, schedule, spec); + + try { + // GET + CloudJobSchedule jobSchedule = batchClient.jobScheduleOperations().getJobSchedule(jobScheduleId); + Assert.assertEquals(JobScheduleState.ACTIVE, jobSchedule.state()); + + batchClient.jobScheduleOperations().disableJobSchedule(jobScheduleId); + jobSchedule = batchClient.jobScheduleOperations().getJobSchedule(jobScheduleId); + Assert.assertEquals(JobScheduleState.DISABLED, jobSchedule.state()); + + batchClient.jobScheduleOperations().enableJobSchedule(jobScheduleId); + jobSchedule = batchClient.jobScheduleOperations().getJobSchedule(jobScheduleId); + Assert.assertEquals(JobScheduleState.ACTIVE, jobSchedule.state()); + + batchClient.jobScheduleOperations().terminateJobSchedule(jobScheduleId); + jobSchedule = batchClient.jobScheduleOperations().getJobSchedule(jobScheduleId); + Assert.assertTrue(jobSchedule.state() == JobScheduleState.TERMINATING || jobSchedule.state() == JobScheduleState.COMPLETED); + + Thread.sleep(2 * 1000); + jobSchedule = batchClient.jobScheduleOperations().getJobSchedule(jobScheduleId); + Assert.assertEquals(JobScheduleState.COMPLETED, jobSchedule.state()); + + batchClient.jobScheduleOperations().deleteJobSchedule(jobScheduleId); + try { + jobSchedule = batchClient.jobScheduleOperations().getJobSchedule(jobScheduleId); + Assert.assertTrue("Shouldn't be here, the jobschedule should be deleted", true); + } catch (BatchErrorException err) { + if (!err.body().code().equals(BatchErrorCodeStrings.JobScheduleNotFound)) { + throw err; + } + } + } + finally { + try { + batchClient.jobScheduleOperations().deleteJobSchedule(jobScheduleId); + } + catch (Exception e) { + // Ignore here + } + } + } + +} diff --git a/batch/data-plane/src/test/java/com/microsoft/azure/batch/JobTests.java b/batch/data-plane/src/test/java/com/microsoft/azure/batch/JobTests.java new file mode 100644 index 000000000000..9f2e7cc624a9 --- /dev/null +++ b/batch/data-plane/src/test/java/com/microsoft/azure/batch/JobTests.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.batch.protocol.models.*; +import org.junit.*; + +import java.util.Date; +import java.util.List; + +public class JobTests extends BatchTestBase { + private static CloudPool livePool; + + @BeforeClass + public static void setup() throws Exception { + String testMode = getTestMode(); + Assume.assumeTrue("Tests only run in Record/Live mode", testMode.equals("RECORD")); + createClient(AuthMode.SharedKey); + String poolId = getStringIdWithUserNamePrefix("-testpool"); + livePool = createIfNotExistPaaSPool(poolId); + Assert.assertNotNull(livePool); + } + + @AfterClass + public static void cleanup() throws Exception { + try { + //batchClient.poolOperations().deletePool(livePool.id()); + } + catch (Exception e) { + // ignore any clean up exception + } + } + + @Test + public void canCRUDJob() throws Exception { + // CREATE + String jobId = getStringIdWithUserNamePrefix("-Job-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(livePool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + + try { + // GET + CloudJob job = batchClient.jobOperations().getJob(jobId); + Assert.assertNotNull(job); + Assert.assertEquals(jobId, job.id()); + Assert.assertEquals((Integer) 0, job.priority()); + + // LIST + List jobs = batchClient.jobOperations().listJobs(); + Assert.assertNotNull(jobs); + Assert.assertTrue(jobs.size() > 0); + + boolean found = false; + for (CloudJob j : jobs) { + if (j.id().equals(jobId)) { + found = true; + break; + } + } + + Assert.assertTrue(found); + + + // UPDATE + batchClient.jobOperations().updateJob(jobId, poolInfo, 1, null, null, null); + job = batchClient.jobOperations().getJob(jobId); + Assert.assertEquals((Integer) 1, job.priority()); + + // DELETE + batchClient.jobOperations().deleteJob(jobId); + try { + batchClient.jobOperations().getJob(jobId); + Assert.assertTrue("Shouldn't be here, the job should be deleted", true); + } catch (BatchErrorException err) { + if (!err.body().code().equals(BatchErrorCodeStrings.JobNotFound)) { + throw err; + } + } + + Thread.sleep(1000); + } + finally { + try { + batchClient.jobOperations().deleteJob(jobId); + } + catch (Exception e) { + // Ignore here + } + } + } + + @Test + public void canUpdateJobState() throws Exception { + // CREATE + String jobId = getStringIdWithUserNamePrefix("-Job-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(livePool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + + try { + // GET + CloudJob job = batchClient.jobOperations().getJob(jobId); + Assert.assertEquals(JobState.ACTIVE, job.state()); + + batchClient.jobOperations().disableJob(jobId, DisableJobOption.REQUEUE.REQUEUE); + job = batchClient.jobOperations().getJob(jobId); + Assert.assertEquals(JobState.DISABLING, job.state()); + + Thread.sleep(5 * 1000); + job = batchClient.jobOperations().getJob(jobId); + Assert.assertEquals(JobState.DISABLED, job.state()); + + Assert.assertEquals(OnAllTasksComplete.NO_ACTION, job.onAllTasksComplete()); + batchClient.jobOperations().patchJob(jobId, OnAllTasksComplete.TERMINATE_JOB); + job = batchClient.jobOperations().getJob(jobId); + Assert.assertEquals(OnAllTasksComplete.TERMINATE_JOB, job.onAllTasksComplete()); + + batchClient.jobOperations().enableJob(jobId); + job = batchClient.jobOperations().getJob(jobId); + Assert.assertEquals(JobState.ACTIVE, job.state()); + + batchClient.jobOperations().terminateJob(jobId, "myreason"); + job = batchClient.jobOperations().getJob(jobId); + Assert.assertEquals(JobState.TERMINATING, job.state()); + + Thread.sleep(2 * 1000); + job = batchClient.jobOperations().getJob(jobId); + Assert.assertEquals(JobState.COMPLETED, job.state()); + } + finally { + try { + batchClient.jobOperations().deleteJob(jobId); + } + catch (Exception e) { + // Ignore here + } + } + } + +} diff --git a/batch/data-plane/src/test/java/com/microsoft/azure/batch/PoolTests.java b/batch/data-plane/src/test/java/com/microsoft/azure/batch/PoolTests.java new file mode 100644 index 000000000000..e96eea19f135 --- /dev/null +++ b/batch/data-plane/src/test/java/com/microsoft/azure/batch/PoolTests.java @@ -0,0 +1,578 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import org.junit.*; + +import java.util.*; +import com.microsoft.azure.batch.protocol.models.*; + +public class PoolTests extends BatchTestBase { + private static CloudPool livePool; + + @BeforeClass + public static void setup() throws Exception { + String testMode = getTestMode(); + Assume.assumeTrue("Tests only run in Record/Live mode", testMode.equals("RECORD")); + createClient(AuthMode.SharedKey); + String poolId = getStringIdWithUserNamePrefix("-testpool"); + livePool = createIfNotExistPaaSPool(poolId); + Assert.assertNotNull(livePool); + } + + @AfterClass + public static void cleanup() throws Exception { + try { + // batchClient.poolOperations().deletePool(livePool.id()); + } catch (Exception e) { + // ignore any clean up exception + } + } + + @Test + public void testPoolOData() throws Exception { + CloudPool pool = batchClient.poolOperations().getPool(livePool.id(), + new DetailLevel.Builder().withExpandClause("stats").build()); + Assert.assertNotNull(pool.stats()); + + List pools = batchClient.poolOperations() + .listPools(new DetailLevel.Builder().withSelectClause("id, state").build()); + Assert.assertTrue(pools.size() > 0); + Assert.assertNotNull(pools.get(0).id()); + Assert.assertNull(pools.get(0).vmSize()); + + // Test assumes not run in parallel + pools = batchClient.poolOperations() + .listPools(new DetailLevel.Builder().withFilterClause("state eq 'deleting'").build()); + Assert.assertEquals(0, pools.size()); + } + + @Test + public void canCRUDLowPriIaaSPool() throws Exception { + // CREATE + String poolId = getStringIdWithUserNamePrefix("-canCRUDLowPri-testPool"); + + // Create a pool with 3 Small VMs + String POOL_VM_SIZE = "STANDARD_A1"; + int POOL_VM_COUNT = 0; + int POOL_LOW_PRI_VM_COUNT = 2; + + // 5 minutes + long POOL_STEADY_TIMEOUT_IN_SECONDS = 5 * 60 * 1000; + + // Check if pool exists + if (!batchClient.poolOperations().existsPool(poolId)) { + ImageReference imgRef = new ImageReference().withPublisher("Canonical").withOffer("UbuntuServer") + .withSku("16.04-LTS").withVersion("latest"); + VirtualMachineConfiguration configuration = new VirtualMachineConfiguration(); + configuration.withNodeAgentSKUId("batch.node.ubuntu 16.04").withImageReference(imgRef); + + NetworkConfiguration netConfig = new NetworkConfiguration(); + PoolEndpointConfiguration endpointConfig = new PoolEndpointConfiguration(); + List inbounds = new ArrayList<>(); + inbounds.add(new InboundNATPool().withName("testinbound").withProtocol(InboundEndpointProtocol.TCP) + .withBackendPort(5000).withFrontendPortRangeStart(60000).withFrontendPortRangeEnd(60040)); + endpointConfig.withInboundNATPools(inbounds); + netConfig.withEndpointConfiguration(endpointConfig); + + PoolAddParameter addParameter = new PoolAddParameter().withId(poolId) + .withTargetDedicatedNodes(POOL_VM_COUNT).withTargetLowPriorityNodes(POOL_LOW_PRI_VM_COUNT) + .withVmSize(POOL_VM_SIZE).withVirtualMachineConfiguration(configuration) + .withNetworkConfiguration(netConfig); + batchClient.poolOperations().createPool(addParameter); + } + + try { + // GET + Assert.assertTrue(batchClient.poolOperations().existsPool(poolId)); + + long startTime = System.currentTimeMillis(); + long elapsedTime = 0L; + boolean steady = false; + CloudPool pool = null; + + // Wait for the VM to be allocated + while (elapsedTime < POOL_STEADY_TIMEOUT_IN_SECONDS) { + pool = batchClient.poolOperations().getPool(poolId); + Assert.assertNotNull(pool); + + if (pool.allocationState() == AllocationState.STEADY) { + steady = true; + break; + } + System.out.println("wait 120 seconds for pool steady..."); + Thread.sleep(120 * 1000); + elapsedTime = (new Date()).getTime() - startTime; + } + + Assert.assertTrue("The pool did not reach a steady state in the allotted time", steady); + Assert.assertEquals(POOL_VM_COUNT, (long) pool.currentDedicatedNodes()); + Assert.assertEquals(POOL_LOW_PRI_VM_COUNT, (long) pool.currentLowPriorityNodes()); + + List computeNodes = batchClient.computeNodeOperations().listComputeNodes(poolId); + List inboundEndpoints = computeNodes.get(0).endpointConfiguration().inboundEndpoints(); + Assert.assertEquals(2, inboundEndpoints.size()); + InboundEndpoint inboundEndpoint = inboundEndpoints.get(0); + Assert.assertEquals(5000, inboundEndpoint.backendPort()); + Assert.assertTrue(inboundEndpoint.frontendPort() >= 60000); + Assert.assertTrue(inboundEndpoint.frontendPort() <= 60040); + Assert.assertTrue(inboundEndpoint.name().startsWith("testinbound.")); + Assert.assertTrue(inboundEndpoints.get(1).name().startsWith("SSHRule")); + + // CHECK POOL NODE COUNTS + PoolNodeCounts poolNodeCount = null; + List poolNodeCounts = batchClient.accountOperations().listPoolNodeCounts(); + for (PoolNodeCounts tmp : poolNodeCounts) { + if (tmp.poolId().equals(poolId)) { + poolNodeCount = tmp; + break; + } + } + Assert.assertNotNull(poolNodeCount); // Single pool only + Assert.assertNotNull(poolNodeCount.lowPriority()); + + Assert.assertEquals(2, poolNodeCount.lowPriority().total()); + Assert.assertEquals(0, poolNodeCount.dedicated().total()); + + // RESIZE + batchClient.poolOperations().resizePool(poolId, 1, 1); + + pool = batchClient.poolOperations().getPool(poolId); + Assert.assertEquals(1, (long) pool.targetDedicatedNodes()); + Assert.assertEquals(1, (long) pool.targetLowPriorityNodes()); + + // DELETE + boolean deleted = false; + batchClient.poolOperations().deletePool(poolId); + // Wait for the VM to be allocated + while (elapsedTime < POOL_STEADY_TIMEOUT_IN_SECONDS * 2) { + try { + batchClient.poolOperations().getPool(poolId); + } catch (BatchErrorException err) { + if (err.body().code().equals(BatchErrorCodeStrings.PoolNotFound)) { + deleted = true; + break; + } else { + throw err; + } + } + System.out.println("wait 15 seconds for pool delete..."); + Thread.sleep(15 * 1000); + elapsedTime = (new Date()).getTime() - startTime; + } + Assert.assertTrue(deleted); + } finally { + try { + if (batchClient.poolOperations().existsPool(poolId)) { + batchClient.poolOperations().deletePool(poolId); + } + } catch (Exception e) { + // Ignore exception + } + } + } + + @Test + public void canCreateDataDisk() throws Exception { + String poolId = getStringIdWithUserNamePrefix("-testpool3"); + + // Create a pool with 0 Small VMs + String POOL_VM_SIZE = "STANDARD_D1"; + int POOL_VM_COUNT = 0; + int lun = 50; + int diskSizeGB = 50; + + // Use IaaS VM with Linux + List dataDisks = new ArrayList(); + dataDisks.add(new DataDisk().withLun(lun).withDiskSizeGB(diskSizeGB)); + VirtualMachineConfiguration configuration = new VirtualMachineConfiguration(); + configuration + .withImageReference( + new ImageReference().withPublisher("Canonical").withOffer("UbuntuServer").withSku("16.04-LTS")) + .withNodeAgentSKUId("batch.node.ubuntu 16.04").withDataDisks(dataDisks); + + try { + batchClient.poolOperations().createPool(poolId, POOL_VM_SIZE, configuration, POOL_VM_COUNT); + + CloudPool pool = batchClient.poolOperations().getPool(poolId); + Assert.assertEquals(lun, pool.virtualMachineConfiguration().dataDisks().get(0).lun()); + Assert.assertEquals(diskSizeGB, pool.virtualMachineConfiguration().dataDisks().get(0).diskSizeGB()); + } finally { + try { + if (batchClient.poolOperations().existsPool(poolId)) { + batchClient.poolOperations().deletePool(poolId); + } + } catch (Exception e) { + // Ignore exception + } + } + } + + @Test + public void canCreateCustomImageWithExpectedError() throws Exception { + String poolId = getStringIdWithUserNamePrefix("-customImageExpErr"); + + // Create a pool with 0 Small VMs + String POOL_VM_SIZE = "STANDARD_D1"; + int POOL_VM_COUNT = 0; + + // Use IaaS VM with Linux + VirtualMachineConfiguration configuration = new VirtualMachineConfiguration(); + configuration.withImageReference(new ImageReference().withVirtualMachineImageId( + "/subscriptions/f30ef677-64a9-4768-934f-5fbbc0e1ad27/resourceGroups/batchexp/providers/Microsoft.Compute/images/FakeImage")) + .withNodeAgentSKUId("batch.node.ubuntu 16.04"); + + try { + batchClient.poolOperations().createPool(poolId, POOL_VM_SIZE, configuration, POOL_VM_COUNT); + throw new Exception("Expect exception, but not got it."); + } catch (BatchErrorException err) { + if (err.body().code().equals("InsufficientPermissions")) { + // Accepted Error + Assert.assertTrue(err.body().values().get(0).value().contains( + "The user identity used for this operation does not have the required privelege Microsoft.Compute/images/read on the specified resource")); + } else { + if (!err.body().code().equals("InvalidPropertyValue")) { + throw err; + } + } + } finally { + try { + if (batchClient.poolOperations().existsPool(poolId)) { + batchClient.poolOperations().deletePool(poolId); + } + } catch (Exception e) { + // Ignore exception + } + } + } + + @Test + public void shouldFailOnCreateContainerPoolWithRegularImage() throws Exception { + String poolId = getStringIdWithUserNamePrefix("-createContainerRegImage"); + + // Create a pool with 0 Small VMs + String POOL_VM_SIZE = "STANDARD_D1"; + int POOL_VM_COUNT = 0; + + // Use IaaS VM with Linux + List images = new ArrayList(); + images.add("ubuntu"); + VirtualMachineConfiguration configuration = new VirtualMachineConfiguration(); + configuration + .withImageReference( + new ImageReference().withPublisher("Canonical").withOffer("UbuntuServer").withSku("16.04-LTS")) + .withNodeAgentSKUId("batch.node.ubuntu 16.04") + .withContainerConfiguration(new ContainerConfiguration().withContainerImageNames(images)); + + try { + batchClient.poolOperations().createPool(poolId, POOL_VM_SIZE, configuration, POOL_VM_COUNT); + throw new Exception("The test case should throw exception here"); + } catch (BatchErrorException err) { + if (err.body().code().equals("InvalidPropertyValue")) { + // Accepted Error + for (int i = 0; i < err.body().values().size(); i++) { + if (err.body().values().get(i).key().equals("Reason")) { + Assert.assertEquals( + "The specified imageReference with publisher Canonical offer UbuntuServer sku 16.04-LTS does not support container feature.", + err.body().values().get(i).value()); + return; + } + } + throw new Exception("Couldn't find expect error reason"); + } else { + throw err; + } + } finally { + try { + if (batchClient.poolOperations().existsPool(poolId)) { + batchClient.poolOperations().deletePool(poolId); + } + } catch (Exception e) { + // Ignore exception + } + } + } + + //Temporarily disabling this test - REST API is missing the logic for this case. + @Ignore + @Test + public void shouldFailOnCreateLinuxPoolWithWindowsConfig() throws Exception { + String poolId = getStringIdWithUserNamePrefix("-createLinuxPool"); + + // Create a pool with 0 Small VMs + String POOL_VM_SIZE = "STANDARD_D1"; + int POOL_VM_COUNT = 0; + + // Use IaaS VM with Linux + List images = new ArrayList(); + images.add("ubuntu"); + VirtualMachineConfiguration configuration = new VirtualMachineConfiguration(); + configuration + .withImageReference( + new ImageReference().withPublisher("Canonical").withOffer("UbuntuServer").withSku("16.04-LTS")) + .withNodeAgentSKUId("batch.node.ubuntu 16.04"); + UserAccount windowsUser = new UserAccount(); + windowsUser.withWindowsUserConfiguration(new WindowsUserConfiguration().withLoginMode(LoginMode.INTERACTIVE)) + .withName("testaccount") + .withPassword("password"); + ArrayList users = new ArrayList(); + users.add(windowsUser); + PoolAddParameter pool = new PoolAddParameter().withId(poolId) + .withVirtualMachineConfiguration(configuration) + .withTargetDedicatedNodes(POOL_VM_COUNT) + .withTargetLowPriorityNodes(0) + .withVmSize(POOL_VM_SIZE) + .withUserAccounts(users); + + try { + batchClient.poolOperations().createPool(pool); + throw new Exception("The test case should throw exception here"); + } catch (BatchErrorException err) { + if (err.body().code().equals("InvalidPropertyValue")) { + // Accepted Error + for (int i = 0; i < err.body().values().size(); i++) { + if (err.body().values().get(i).key().equals("Reason")) { + Assert.assertEquals( + "The value provided for one of the properties in the request body is invalid.", + err.body().values().get(i).value()); + return; + } + } + throw new Exception("Couldn't find expect error reason"); + } else { + throw err; + } + } finally { + try { + if (batchClient.poolOperations().existsPool(poolId)) { + batchClient.poolOperations().deletePool(poolId); + } + } catch (Exception e) { + // Ignore exception + } + } + } + + @Test + public void canCRUDLowPriPaaSPool() throws Exception { + // CREATE + String poolId = getStringIdWithUserNamePrefix("-testpool4"); + + // Create a pool with 3 Small VMs + String POOL_VM_SIZE = "Small"; + int POOL_VM_COUNT = 1; + int POOL_LOW_PRI_VM_COUNT = 2; + String POOL_OS_FAMILY = "4"; + String POOL_OS_VERSION = "*"; + + // 5 minutes + long POOL_STEADY_TIMEOUT_IN_SECONDS = 5 * 60 * 1000; + + // Check if pool exists + if (!batchClient.poolOperations().existsPool(poolId)) { + // Use PaaS VM with Windows + CloudServiceConfiguration configuration = new CloudServiceConfiguration(); + configuration.withOsFamily(POOL_OS_FAMILY).withOsVersion(POOL_OS_VERSION); + + batchClient.poolOperations().createPool(poolId, POOL_VM_SIZE, configuration, POOL_VM_COUNT, + POOL_LOW_PRI_VM_COUNT); + } + + try { + // GET + Assert.assertTrue(batchClient.poolOperations().existsPool(poolId)); + + long startTime = System.currentTimeMillis(); + long elapsedTime = 0L; + boolean steady = false; + CloudPool pool = null; + + // Wait for the VM to be allocated + while (elapsedTime < POOL_STEADY_TIMEOUT_IN_SECONDS) { + pool = batchClient.poolOperations().getPool(poolId); + Assert.assertNotNull(pool); + + if (pool.allocationState() == AllocationState.STEADY) { + steady = true; + break; + } + System.out.println("wait 30 seconds for pool steady..."); + Thread.sleep(30 * 1000); + elapsedTime = (new Date()).getTime() - startTime; + } + + Assert.assertTrue("The pool did not reach a steady state in the allotted time", steady); + Assert.assertEquals(POOL_VM_COUNT, (long) pool.currentDedicatedNodes()); + Assert.assertEquals(POOL_LOW_PRI_VM_COUNT, (long) pool.currentLowPriorityNodes()); + + // RESIZE + batchClient.poolOperations().resizePool(poolId, null, 1); + + pool = batchClient.poolOperations().getPool(poolId); + Assert.assertEquals(POOL_VM_COUNT, (long) pool.targetDedicatedNodes()); + Assert.assertEquals(1, (long) pool.targetLowPriorityNodes()); + + // DELETE + boolean deleted = false; + batchClient.poolOperations().deletePool(poolId); + // Wait for the VM to be allocated + while (elapsedTime < POOL_STEADY_TIMEOUT_IN_SECONDS * 2) { + try { + batchClient.poolOperations().getPool(poolId); + } catch (BatchErrorException err) { + if (err.body().code().equals(BatchErrorCodeStrings.PoolNotFound)) { + deleted = true; + break; + } else { + throw err; + } + } + System.out.println("wait 15 seconds for pool delete..."); + Thread.sleep(15 * 1000); + elapsedTime = (new Date()).getTime() - startTime; + } + Assert.assertTrue(deleted); + } finally { + try { + if (batchClient.poolOperations().existsPool(poolId)) { + batchClient.poolOperations().deletePool(poolId); + } + } catch (Exception e) { + // Ignore exception + } + } + } + + @Test + public void canCRUDPaaSPool() throws Exception { + // CREATE + String poolId = getStringIdWithUserNamePrefix("-CRUDPaaS"); + + // Create a pool with 3 Small VMs + String POOL_VM_SIZE = "Small"; + int POOL_VM_COUNT = 3; + String POOL_OS_FAMILY = "4"; + String POOL_OS_VERSION = "*"; + // 15 minutes + long POOL_STEADY_TIMEOUT_IN_SECONDS = 15 * 60 * 1000; + + // Check if pool exists + if (!batchClient.poolOperations().existsPool(poolId)) { + // Use PaaS VM with Windows + CloudServiceConfiguration configuration = new CloudServiceConfiguration(); + configuration.withOsFamily(POOL_OS_FAMILY).withOsVersion(POOL_OS_VERSION); + + List userList = new ArrayList<>(); + userList.add(new UserAccount().withName("test-user-1").withPassword("kt#_gahr!@aGERDXA")); + userList.add(new UserAccount().withName("test-user-2").withPassword("kt#_gahr!@aGERDXA") + .withElevationLevel(ElevationLevel.ADMIN)); + PoolAddParameter addParameter = new PoolAddParameter().withId(poolId) + .withTargetDedicatedNodes(POOL_VM_COUNT).withVmSize(POOL_VM_SIZE) + .withCloudServiceConfiguration(configuration).withUserAccounts(userList); + batchClient.poolOperations().createPool(addParameter); + } + + try { + // GET + Assert.assertTrue(batchClient.poolOperations().existsPool(poolId)); + + long startTime = System.currentTimeMillis(); + long elapsedTime = 0L; + boolean steady = false; + CloudPool pool = null; + + // Wait for the VM to be allocated + while (elapsedTime < POOL_STEADY_TIMEOUT_IN_SECONDS) { + pool = batchClient.poolOperations().getPool(poolId); + Assert.assertNotNull(pool); + + if (pool.allocationState() == AllocationState.STEADY) { + steady = true; + break; + } + System.out.println("wait 30 seconds for pool steady..."); + Thread.sleep(30 * 1000); + elapsedTime = (new Date()).getTime() - startTime; + } + + Assert.assertTrue("The pool did not reach a steady state in the allotted time", steady); + Assert.assertNotNull(pool.userAccounts()); + Assert.assertEquals("test-user-1", pool.userAccounts().get(0).name()); + Assert.assertEquals(ElevationLevel.NON_ADMIN, pool.userAccounts().get(0).elevationLevel()); + Assert.assertNull(pool.userAccounts().get(0).password()); + Assert.assertEquals(ElevationLevel.ADMIN, pool.userAccounts().get(1).elevationLevel()); + + // LIST + List pools = batchClient.poolOperations().listPools(); + Assert.assertTrue(pools.size() > 0); + + boolean found = false; + for (CloudPool p : pools) { + if (p.id().equals(poolId)) { + found = true; + break; + } + } + + Assert.assertTrue(found); + + // CHECK POOL NODE COUNTS + PoolNodeCounts poolNodeCount = null; + List poolNodeCounts = batchClient.accountOperations().listPoolNodeCounts(); + for (PoolNodeCounts tmp : poolNodeCounts) { + if (tmp.poolId().equals(poolId)) { + poolNodeCount = tmp; + break; + } + } + Assert.assertNotNull(poolNodeCount); // Single pool only + Assert.assertNotNull(poolNodeCount.lowPriority()); + Assert.assertEquals(0, poolNodeCount.lowPriority().total()); + Assert.assertEquals(3, poolNodeCount.dedicated().total()); + + // UPDATE + LinkedList metadata = new LinkedList<>(); + metadata.add((new MetadataItem()).withName("key1").withValue("value1")); + batchClient.poolOperations().patchPool(poolId, null, null, null, metadata); + + pool = batchClient.poolOperations().getPool(poolId); + Assert.assertTrue(pool.metadata().size() == 1); + Assert.assertTrue(pool.metadata().get(0).name().equals("key1")); + + batchClient.poolOperations().updatePoolProperties(poolId, null, new LinkedList(), + new LinkedList(), new LinkedList()); + pool = batchClient.poolOperations().getPool(poolId); + Assert.assertNull(pool.metadata()); + + // DELETE + boolean deleted = false; + batchClient.poolOperations().deletePool(poolId); + // Wait for the VM to be allocated + while (elapsedTime < POOL_STEADY_TIMEOUT_IN_SECONDS) { + try { + batchClient.poolOperations().getPool(poolId); + } catch (BatchErrorException err) { + if (err.body().code().equals(BatchErrorCodeStrings.PoolNotFound)) { + deleted = true; + break; + } else { + throw err; + } + } + System.out.println("wait 5 seconds for pool delete..."); + Thread.sleep(5 * 1000); + elapsedTime = (new Date()).getTime() - startTime; + } + Assert.assertTrue(deleted); + } finally { + try { + if (batchClient.poolOperations().existsPool(poolId)) { + batchClient.poolOperations().deletePool(poolId); + } + } catch (Exception e) { + // Ignore exception + } + } + } +} diff --git a/batch/data-plane/src/test/java/com/microsoft/azure/batch/TaskTests.java b/batch/data-plane/src/test/java/com/microsoft/azure/batch/TaskTests.java new file mode 100644 index 000000000000..3dd6642c8ddb --- /dev/null +++ b/batch/data-plane/src/test/java/com/microsoft/azure/batch/TaskTests.java @@ -0,0 +1,534 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.batch; + +import com.microsoft.azure.batch.auth.BatchSharedKeyCredentials; +import com.microsoft.azure.batch.interceptor.BatchClientParallelOptions; +import com.microsoft.azure.batch.protocol.models.*; +import com.microsoft.azure.storage.blob.CloudBlobContainer; +import org.joda.time.DateTime; +import org.joda.time.Period; +import org.junit.*; + +import java.io.*; +import java.util.*; +import java.util.concurrent.TimeUnit; + +public class TaskTests extends BatchTestBase { + private static CloudPool livePool; + private static CloudPool liveIaaSPool; + + @BeforeClass + public static void setup() throws Exception { + String testMode = getTestMode(); + Assume.assumeTrue("Tests only run in Record/Live mode", testMode.equals("RECORD")); + try { + createClient(AuthMode.SharedKey); + String poolId = getStringIdWithUserNamePrefix("-testpool"); + livePool = createIfNotExistPaaSPool(poolId); + poolId = getStringIdWithUserNamePrefix("-testIaaSpool"); + liveIaaSPool = createIfNotExistIaaSPool(poolId); + Assert.assertNotNull(livePool); + } catch (BatchErrorException e) { + cleanup(); + throw e; + } + } + + @AfterClass + public static void cleanup() throws Exception { + try { + // batchClient.poolOperations().deletePool(livePool.id()); + } catch (Exception e) { + // ignore any clean up exception + } + try { + // batchClient.poolOperations().deletePool(liveIaasPool.id()); + } catch (Exception e) { + // ignore any clean up exception + } + } + + @Test + public void canCRUDTest() throws Exception { + int TASK_COMPLETE_TIMEOUT_IN_SECONDS = 60; // 60 seconds timeout + String STANDARD_CONSOLE_OUTPUT_FILENAME = "stdout.txt"; + String BLOB_FILE_NAME = "test.txt"; + String taskId = "mytask"; + File temp = File.createTempFile("tempFile", ".tmp"); + BufferedWriter bw = new BufferedWriter(new FileWriter(temp)); + bw.write("This is an example"); + bw.close(); + temp.deleteOnExit(); + String jobId = getStringIdWithUserNamePrefix("-canCRUDTest-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(liveIaaSPool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + + String storageAccountName = System.getenv("STORAGE_ACCOUNT_NAME"); + String storageAccountKey = System.getenv("STORAGE_ACCOUNT_KEY"); + + try { + // Create storage container + CloudBlobContainer container = createBlobContainer(storageAccountName, storageAccountKey, "testaddtask"); + String sas = uploadFileToCloud(container, BLOB_FILE_NAME, temp.getAbsolutePath()); + + // Associate resource file with task + ResourceFile file = new ResourceFile(); + file.withFilePath(BLOB_FILE_NAME); + file.withHttpUrl(sas); + List files = new ArrayList<>(); + files.add(file); + + // CREATE + TaskAddParameter taskToAdd = new TaskAddParameter(); + taskToAdd.withId(taskId).withCommandLine(String.format("/bin/bash -c 'set -e; set -o pipefail; cat %s'", BLOB_FILE_NAME)).withResourceFiles(files); + + batchClient.taskOperations().createTask(jobId, taskToAdd); + + // GET + CloudTask task = batchClient.taskOperations().getTask(jobId, taskId); + Assert.assertNotNull(task); + Assert.assertEquals(taskId, task.id()); + + // Verify default retention time + Assert.assertEquals(Period.days(7), task.constraints().retentionTime()); + + // UPDATE + TaskConstraints contraint = new TaskConstraints(); + contraint.withMaxTaskRetryCount(5); + batchClient.taskOperations().updateTask(jobId, taskId, contraint); + task = batchClient.taskOperations().getTask(jobId, taskId); + Assert.assertEquals((Integer)5, task.constraints().maxTaskRetryCount()); + + // LIST + List tasks = batchClient.taskOperations().listTasks(jobId); + Assert.assertNotNull(tasks); + Assert.assertTrue(tasks.size() > 0); + + boolean found = false; + for (CloudTask t : tasks) { + if (t.id().equals(taskId)) { + found = true; + break; + } + } + + Assert.assertTrue(found); + + if (waitForTasksToComplete(batchClient, jobId, TASK_COMPLETE_TIMEOUT_IN_SECONDS)) { + // Get the task command output file + task = batchClient.taskOperations().getTask(jobId, taskId); + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + batchClient.fileOperations().getFileFromTask(jobId, task.id(), STANDARD_CONSOLE_OUTPUT_FILENAME, stream); + String fileContent = stream.toString("UTF-8"); + Assert.assertEquals("This is an example", fileContent); + + // UPLOAD LOG + String outputSas = generateContainerSasToken(container); + UploadBatchServiceLogsResult uploadBatchServiceLogsResult = batchClient.computeNodeOperations().uploadBatchServiceLogs(liveIaaSPool.id(), task.nodeInfo().nodeId(), outputSas, DateTime.now().minusMinutes(-10)); + Assert.assertNotNull(uploadBatchServiceLogsResult); + Assert.assertTrue(uploadBatchServiceLogsResult.numberOfFilesUploaded() > 0); + Assert.assertTrue(uploadBatchServiceLogsResult.virtualDirectoryName().toLowerCase().contains(liveIaaSPool.id().toLowerCase())); + } + + // DELETE + batchClient.taskOperations().deleteTask(jobId, taskId); + try { + batchClient.taskOperations().getTask(jobId, taskId); + Assert.assertTrue("Shouldn't be here, the job should be deleted", true); + } catch (BatchErrorException err) { + if (!err.body().code().equals(BatchErrorCodeStrings.TaskNotFound)) { + throw err; + } + } + } finally { + try { + batchClient.jobOperations().deleteJob(jobId); + } catch (Exception e) { + // Ignore here + } + } + } + + @Test + public void testJobUser() throws Exception { + String jobId = getStringIdWithUserNamePrefix("-testJobUser-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + String taskId = "mytask"; + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(livePool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + + try { + // CREATE + List apps = new ArrayList<>(); + apps.add(new ApplicationPackageReference().withApplicationId("MSMPI")); + TaskAddParameter taskToAdd = new TaskAddParameter(); + taskToAdd.withId(taskId) + .withCommandLine("cmd /c echo hello") + .withUserIdentity(new UserIdentity() + .withUserName("test-user")) + .withApplicationPackageReferences(apps); + + batchClient.taskOperations().createTask(jobId, taskToAdd); + + // GET + CloudTask task = batchClient.taskOperations().getTask(jobId, taskId); + Assert.assertNotNull(task); + Assert.assertEquals(taskId, task.id()); + Assert.assertEquals("test-user", task.userIdentity().userName()); + Assert.assertEquals("msmpi", task.applicationPackageReferences().get(0).applicationId()); + + } finally { + try { + batchClient.jobOperations().deleteJob(jobId); + } catch (Exception e) { + // Ignore here + } + } + } + + @Test + public void testOutputFiles() throws Exception { + int TASK_COMPLETE_TIMEOUT_IN_SECONDS = 60; // 60 seconds timeout + String jobId = getStringIdWithUserNamePrefix("-testOutputFiles-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + String taskId = "mytask"; + String badTaskId = "mytask1"; + String storageAccountName = System.getenv("STORAGE_ACCOUNT_NAME"); + String storageAccountKey = System.getenv("STORAGE_ACCOUNT_KEY"); + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(liveIaaSPool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + CloudBlobContainer container = createBlobContainer(storageAccountName, storageAccountKey, "output"); + String containerUrl = generateContainerSasToken(container); + + try { + // CREATE + List outputs = new ArrayList<>(); + outputs.add(new OutputFile() + .withFilePattern("../stdout.txt") + .withDestination(new OutputFileDestination() + .withContainer(new OutputFileBlobContainerDestination() + .withContainerUrl(containerUrl) + .withPath("taskLogs/output.txt"))) + .withUploadOptions(new OutputFileUploadOptions() + .withUploadCondition(OutputFileUploadCondition.TASK_COMPLETION))); + outputs.add(new OutputFile() + .withFilePattern("../stderr.txt") + .withDestination(new OutputFileDestination() + .withContainer(new OutputFileBlobContainerDestination() + .withContainerUrl(containerUrl) + .withPath("taskLogs/err.txt"))) + .withUploadOptions(new OutputFileUploadOptions() + .withUploadCondition(OutputFileUploadCondition.TASK_FAILURE))); + TaskAddParameter taskToAdd = new TaskAddParameter(); + taskToAdd.withId(taskId) + .withCommandLine("bash -c \"echo hello\"") + .withOutputFiles(outputs); + + batchClient.taskOperations().createTask(jobId, taskToAdd); + + if (waitForTasksToComplete(batchClient, jobId, TASK_COMPLETE_TIMEOUT_IN_SECONDS)) { + CloudTask task = batchClient.taskOperations().getTask(jobId, taskId); + Assert.assertNotNull(task); + Assert.assertEquals(TaskExecutionResult.SUCCESS, task.executionInfo().result()); + Assert.assertNull(task.executionInfo().failureInfo()); + + // Get the task command output file + String result = getContentFromContainer(container, "taskLogs/output.txt"); + Assert.assertEquals("hello\n", result); + } + + taskToAdd = new TaskAddParameter(); + taskToAdd.withId(badTaskId) + .withCommandLine("bash -c \"bad command\"") + .withOutputFiles(outputs); + + batchClient.taskOperations().createTask(jobId, taskToAdd); + + if (waitForTasksToComplete(batchClient, jobId, TASK_COMPLETE_TIMEOUT_IN_SECONDS)) { + CloudTask task = batchClient.taskOperations().getTask(jobId, badTaskId); + Assert.assertNotNull(task); + Assert.assertEquals(TaskExecutionResult.FAILURE, task.executionInfo().result()); + Assert.assertNotNull(task.executionInfo().failureInfo()); + Assert.assertEquals(ErrorCategory.USER_ERROR, task.executionInfo().failureInfo().category()); + Assert.assertEquals("FailureExitCode", task.executionInfo().failureInfo().code()); + + // Get the task command output file + String result = getContentFromContainer(container, "taskLogs/err.txt"); + Assert.assertEquals("bash: bad: command not found\n", result); + } + + } finally { + try { + container.delete(); + batchClient.jobOperations().deleteJob(jobId); + } catch (Exception e) { + // Ignore here + } + } + } + + @Test + public void testAddMultiTasks() throws Exception { + String jobId = getStringIdWithUserNamePrefix("-testAddMultiTasks-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(livePool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + + + int TASK_COUNT=1000; + + try { + // CREATE + List tasksToAdd = new ArrayList<>(); + for (int i=0; i behaviors = new HashSet<>(); + behaviors.add(option); + batchClient.taskOperations().createTasks(jobId, tasksToAdd, behaviors); + + // LIST + List tasks = batchClient.taskOperations().listTasks(jobId); + Assert.assertNotNull(tasks); + Assert.assertTrue(tasks.size() == TASK_COUNT); + } finally { + try { + batchClient.jobOperations().deleteJob(jobId); + } catch (Exception e) { + // Ignore here + } + } + } + + + @Test + public void testAddMultiTasksWithError() throws Exception { + + BatchSharedKeyCredentials noExistCredentials1 = new BatchSharedKeyCredentials( + "https://noexistaccount.westus.batch.azure.com", + "noexistaccount", + System.getenv("AZURE_BATCH_ACCESS_KEY")); + BatchClient testBatchClient = BatchClient.open(noExistCredentials1); + + String jobId = getStringIdWithUserNamePrefix("-testAddMultiTasksWithError-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + + int TASK_COUNT=1000; + + try { + // CREATE + List tasksToAdd = new ArrayList<>(); + for (int i=0; i behaviors = new HashSet<>(); + behaviors.add(option); + testBatchClient.taskOperations().createTasks(jobId, tasksToAdd, behaviors); + Assert.assertTrue("Should not here", true); + } catch (RuntimeException ex) { + System.out.printf("Expect exception %s", ex.toString()); + } + } + + @Test + public void testGetTaskCounts() throws Exception { + String jobId = getStringIdWithUserNamePrefix("-testGetTaskCounts-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(livePool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + + + int TASK_COUNT=1000; + + try { + // Test Job count + TaskCounts counts = batchClient.jobOperations().getTaskCounts(jobId); + int all = counts.active() + counts.completed() + counts.running(); + Assert.assertEquals(0, all); + + // CREATE + List tasksToAdd = new ArrayList<>(); + for (int i=0; i behaviors = new HashSet<>(); + behaviors.add(option); + batchClient.taskOperations().createTasks(jobId, tasksToAdd, behaviors); + + TimeUnit.SECONDS.sleep(30); + + // Test Job count + counts = batchClient.jobOperations().getTaskCounts(jobId); + all = counts.active() + counts.completed() + counts.running(); + Assert.assertEquals(TASK_COUNT, all); + } finally { + try { + batchClient.jobOperations().deleteJob(jobId); + } catch (Exception e) { + // Ignore here + } + } + } + + @Test + public void failCreateContainerTaskWithRegularPool() throws Exception { + String jobId = getStringIdWithUserNamePrefix("-failCreateContainerRegPool-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + String taskId = "mytask"; + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(liveIaaSPool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + + TaskAddParameter taskToAdd = new TaskAddParameter(); + taskToAdd.withId(taskId) + .withContainerSettings(new TaskContainerSettings() + .withContainerRunOptions("--rm") + .withImageName("centos")) + .withCommandLine("bash -c \"echo hello\""); + + try + { + batchClient.taskOperations().createTask(jobId, taskToAdd); + } + catch (BatchErrorException err) { + if (err.body().code().equals("InvalidPropertyValue")) { + // Accepted Error + for (int i = 0; i < err.body().values().size(); i++) { + if (err.body().values().get(i).key().equals("Reason")) { + Assert.assertEquals("The specified imageReference with publisher Canonical offer UbuntuServer sku 16.04-LTS does not support container feature.", err.body().values().get(i).value()); + return; + } + } + throw new Exception("Couldn't find expect error reason"); + } else { + throw err; + } + } + finally { + try { + batchClient.jobOperations().deleteJob(jobId); + } catch (Exception e) { + // Ignore here + } + } + } + + @Test + public void failIfPoisonTaskTooLarge() throws Exception { + String jobId = getStringIdWithUserNamePrefix("-failIfPoisonTaskTooLarge-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + String taskId = "mytask"; + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(liveIaaSPool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + + List tasksToAdd = new ArrayList(); + TaskAddParameter taskToAdd = new TaskAddParameter(); + List resourceFiles = new ArrayList(); + ResourceFile resourceFile; + // If this test fails try increasing the size of the Task in case maximum size increase + for(int i = 0; i < 10000; i++) { + resourceFile = new ResourceFile().withHttpUrl("https://mystorageaccount.blob.core.windows.net/files/resourceFile"+i).withFilePath("resourceFile"+i); + resourceFiles.add(resourceFile); + } + taskToAdd.withId(taskId).withResourceFiles(resourceFiles).withCommandLine("sleep 1"); + tasksToAdd.add(taskToAdd); + + try + { + batchClient.taskOperations().createTasks(jobId, tasksToAdd); + try { + batchClient.jobOperations().deleteJob(jobId); + } catch (Exception e) { + // Ignore here + } + Assert.fail("Expected RequestBodyTooLarge error"); + } + catch (BatchErrorException err) { + try { + batchClient.jobOperations().deleteJob(jobId); + } catch (Exception e) { + // Ignore here + } + Assert.assertEquals(err.body().code(), BatchErrorCodeStrings.RequestBodyTooLarge); + } + catch (Exception err) { + try { + batchClient.jobOperations().deleteJob(jobId); + } catch (Exception e) { + // Ignore here + } + Assert.fail("Expected RequestBodyTooLarge error"); + } + } + + @Test + public void succeedWithRetry() throws Exception { + String jobId = getStringIdWithUserNamePrefix("-succeedWithRetry-" + (new Date()).toString().replace(' ', '-').replace(':', '-').replace('.', '-')); + String taskId = "mytask"; + + PoolInformation poolInfo = new PoolInformation(); + poolInfo.withPoolId(liveIaaSPool.id()); + batchClient.jobOperations().createJob(jobId, poolInfo); + + List tasksToAdd = new ArrayList(); + TaskAddParameter taskToAdd; + List resourceFiles = new ArrayList(); + ResourceFile resourceFile; + + BatchClientParallelOptions option = new BatchClientParallelOptions(10); + Collection behaviors = new HashSet<>(); + behaviors.add(option); + + // Num Resource Files * Max Chunk Size should be greater than or equal to the limit which triggers the PoisonTask test to ensure we encounter the error in the initial chunk. + for(int i = 0; i < 100; i++) { + resourceFile = new ResourceFile().withHttpUrl("https://mystorageaccount.blob.core.windows.net/files/resourceFile"+i).withFilePath("resourceFile"+i); + resourceFiles.add(resourceFile); + } + // Num tasks to add + for(int i = 0; i < 1500; i++) { + taskToAdd = new TaskAddParameter(); + taskToAdd.withId(taskId+i).withResourceFiles(resourceFiles).withCommandLine("sleep 1"); + tasksToAdd.add(taskToAdd); + } + + try + { + batchClient.taskOperations().createTasks(jobId, tasksToAdd, behaviors); + try { + batchClient.jobOperations().deleteJob(jobId); + } catch (Exception e) { + // Ignore here + } + } + catch (Exception err) { + try { + batchClient.jobOperations().deleteJob(jobId); + } catch (Exception e) { + // Ignore here + } + Assert.fail("Expected Success"); + } + } + +} \ No newline at end of file diff --git a/batch/data-plane/tools/.gitignore b/batch/data-plane/tools/.gitignore new file mode 100644 index 000000000000..7370c55e27ae --- /dev/null +++ b/batch/data-plane/tools/.gitignore @@ -0,0 +1,3 @@ +packages +restore.config +nuget.exe diff --git a/batch/data-plane/tools/autorest.gen.cmd b/batch/data-plane/tools/autorest.gen.cmd new file mode 100644 index 000000000000..c8074b4a21e2 --- /dev/null +++ b/batch/data-plane/tools/autorest.gen.cmd @@ -0,0 +1,14 @@ +setlocal +set specFile=%1 +set namespace=%2 +set generateFolder=%3 + +set source=-Source https://www.myget.org/F/autorest/api/v2 + +set repoRoot=%~dp0.. +set autoRestExe=%repoRoot%\tools\autorest\AutoRest.exe + +@echo on +%autoRestExe% -Modeler Swagger -CodeGenerator Azure.Java -Namespace %namespace% -Input %specFile% -outputDirectory %generateFolder% -Header MICROSOFT_MIT %~5 +@echo off +endlocal diff --git a/batch/data-plane/tools/checkstyle.xml b/batch/data-plane/tools/checkstyle.xml new file mode 100644 index 000000000000..ce47721a7912 --- /dev/null +++ b/batch/data-plane/tools/checkstyle.xml @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/batch/data-plane/tools/policheck-exclusions.mdb b/batch/data-plane/tools/policheck-exclusions.mdb new file mode 100644 index 000000000000..f343d16a7a64 Binary files /dev/null and b/batch/data-plane/tools/policheck-exclusions.mdb differ diff --git a/batch/data-plane/tools/publish.py b/batch/data-plane/tools/publish.py new file mode 100644 index 000000000000..b202e512eb6c --- /dev/null +++ b/batch/data-plane/tools/publish.py @@ -0,0 +1,100 @@ +#!/usr/bin/python +import sys +import os +import fnmatch +import shutil +import re + + +def main(argv): + # validation + if len(argv) < 4: + print "Usage: " + get_usage() + exit(1) + # figure out source dir + folder = os.path.dirname(os.path.realpath(__file__)) + if len(argv) == 5: + folder = argv[4] + if not os.path.isdir(folder): + print "Cannot find directory " + folder + exit(1) + folder = folder.strip('/') + # make working dir + version = argv[1] + working = folder + "/" + version + if os.path.exists(working): + print "Cowardly exiting because " + working + " already exists" + exit(1) + os.mkdir(working) + # copy over all jars + for i in get_jars(folder): + shutil.copy(i, working) + # copy over all poms + pkgs = [] + for i in get_poms(folder): + assert isinstance(i, str) + parts = i.rsplit("\\") + pkg_name = parts[len(parts) - 2] + if len(parts) == len(folder.rsplit("\\")) + 1: + # root folder + shutil.copyfile(i, "%s/%s-%s.pom" % (working, "azure-bom", version)) + pkg_name = "azure-bom" + elif pkg_name == "azure": + # parent folder + shutil.copyfile(i, "%s/%s-%s.pom" % (working, "azure-parent", version)) + pkg_name = "azure-parent" + else: + shutil.copyfile(i, "%s/%s-%s.pom" % (working, pkg_name, version)) + pkgs.append(pkg_name) + # filter out packages + print "Publishing the following: " + to_pub = [] + for pkg in pkgs: + if re.match(argv[3], pkg) is not None: + to_pub.append(os.path.join(working, pkg)) + print pkg + if len(to_pub) == 0: + print "No compiled package matches the regex. Exiting." + exit(1) + for pkg in to_pub: + cmd = "mvn gpg:sign-and-deploy-file" + cmd += " -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/" + cmd += " -DrepositoryId=sonatype-nexus-staging -DpomFile=%s-%s.pom" % (pkg, version) + assert isinstance(pkg, str) + if pkg.endswith("azure-parent") or pkg.endswith("azure-bom"): + cmd += " -Dfile=%s-%s.pom -Dgpg.passphrase=%s" % (pkg, version, argv[2]) + os.system(cmd) + else: + os.system(cmd + " -Dfile=%s-%s.jar -Dgpg.passphrase=%s" % (pkg, version, argv[2])) + os.system(cmd + " -Dfile=%s-%s-javadoc.jar -Dclassifier=javadoc -Dgpg.passphrase=%s" % (pkg, version, argv[2])) + os.system(cmd + " -Dfile=%s-%s-sources.jar -Dclassifier=sources -Dgpg.passphrase=%s" % (pkg, version, argv[2])) + print "Finished." + + +def mvn_package(): + cmd = "mvn package source:jar javadoc:jar" + print "Shell: " + cmd + os.system(cmd) + + +def get_poms(folder): + matches = [] + for root, dirnames, filenames in os.walk(folder): + for filename in fnmatch.filter(filenames, 'pom.xml'): + matches.append(os.path.join(root, filename)) + return matches + + +def get_jars(folder): + matches = [] + for root, dirnames, filenames in os.walk(folder): + for filename in fnmatch.filter(filenames, '*.jar'): + matches.append(os.path.join(root, filename)) + return matches + + +def get_usage(): + return "publish.py version gpg_passphrase package_grep_string [root_directory]" + + +main(sys.argv) diff --git a/batch/data-plane/tools/release-prepare-maven.ps1 b/batch/data-plane/tools/release-prepare-maven.ps1 new file mode 100644 index 000000000000..766e791c6670 --- /dev/null +++ b/batch/data-plane/tools/release-prepare-maven.ps1 @@ -0,0 +1,104 @@ +<# + +.SYNOPSIS +This script helps release batch SDK. + +.DESCRIPTION +This script will do the following things: +1) Create 2 commits in github.com/Azure/azure-batch-sdk-for-java +2) Tag the 1st one as the released hash +3) Put the jars and pom in \\adxsdkbuilder\builds\azure-batch-{version} + +After these are done, you still need to run Jenkins job http://azuresdkci.cloudapp.net/view/5-Signing%20and%20Publishing/job/sign-and-publish-jar. + +.PARAMETER version +The version to release, e.g. 1.0.0-rc + +.PARAMETER tag +The tag name in GitHub, e.g. v1.0.0-rc + +.PARAMETER snapshot +The next development snapshot version, e.g. 1.0.0-rc2-SNAPSHOT + +.EXAMPLE +./release-prepare-maven.ps1 1.2.3 v1.2.3 1.2.4-SNAPSHOT + +#> + +[CmdletBinding()] +Param( + [Parameter(Mandatory=$True, Position=0)] + [string]$version, + + [Parameter(Mandatory=$True, Position=1)] + [string]$tag, + + [Parameter(Mandatory=$True, Position=2)] + [string]$snapshot +) + +$branch = "master" + +# Check branch +echo "Checking if you are on $branch branch..." +If ($(git rev-parse --abbrev-ref HEAD) -ne $branch) { + echo "You are not on $branch branch." + exit(1) +} + +# Check diff +echo "Checking if your $branch is in sync..." +git remote add release https://github.com/Azure/azure-batch-sdk-for-java.git +git fetch release +If ($(git diff release/$branch) -ne $null) { + echo "Your $branch branch is different from https://github.com/Azure/azure-batch-sdk-for-java.git, please sync before running this script." + git remote remove release + exit(1) +} +git remote remove release + +# Check write access +echo "Checking if you have write access to the repo..." +git push origin HEAD:$branch +If (!$?) { + echo "Doesn't have write access to the repo." + exit(1) +} + +# Check if tag exists +echo "Checking if tag $tag already exists..." +$tags=git ls-remote --tags origin +If ($tags -like "*refs/tags/$tag*") { + echo "Tag $tag already exists." + exit(1) +} + +# Run mvn +$cmd = "mvn -Dtag=`"$tag`" -DreleaseVersion=`"$version`" -DdevelopmentVersion=`"$snapshot`" release:prepare -Dresume=false" +echo "Invoking $cmd..." +Invoke-Expression $cmd | Out-Null + +If (!$?) { + echo "Failed to create tag or release commits.." + exit(1) +} + +echo "Release preparation done. Going to tag $tag to build artifacts..." +Invoke-Expression "git checkout `"$tag`"" | Out-Null + +echo "Building artifacts..." +mvn clean source:jar javadoc:jar package -DskipTests | Out-Null + +echo "Copying artifacts to \\adxsdkbuilder\builds\azure-batch-$version..." +New-Item \\adxsdkbuilder\builds\azure-batch-$version -ItemType Directory +Copy-Item pom.xml \\adxsdkbuilder\builds\azure-batch-$version\azure-batch-$version.pom + +$files = Get-ChildItem azure-batch-$version*.jar -Recurse +foreach ($file in $files) { + Copy-Item $file \\adxsdkbuilder\builds\azure-batch-$version +} + +git checkout $branch | Out-Null + +echo "The job is done. Please go to http://azuresdkci.cloudapp.net/view/5-Signing%20and%20Publishing/job/sign-and-publish-jar/build?delay=0sec \ + and build with location parameter `"\\adxsdkbuilder\builds\azure-batch-$version`"." \ No newline at end of file diff --git a/batch/data-plane/tools/runJDiff.cmd b/batch/data-plane/tools/runJDiff.cmd new file mode 100644 index 000000000000..ffadef921ad3 --- /dev/null +++ b/batch/data-plane/tools/runJDiff.cmd @@ -0,0 +1,121 @@ +:: set global variables JDIFF, Branch location, etc +set JDIFF=[JDiff Path] +set OLDBRANCH=[Old branch path] +set NEWBRANCH=[New branch path] + +:: set API name +set OLDRUNTIMEAPI=microsoft-azure-runtime-api-old +set NEWRUNTIMEAPI=microsoft-azure-runtime-api-new +set OLDSERVICEBUSAPI=microsoft-azure-servicebus-api-old +set NEWSERVICEBUSAPI=microsoft-azure-servicebus-api-new +set OLDMEDIASERVICEAPI=microsoft-azure-media-api-old +set NEWMEDIASERVICEAPI=microsoft-azure-media-api-new +set OLDMANAGEMENTAPI=microsoft-azure-management-api-old +set NEWMANAGEMENTAPI=microsoft-azure-management-api-new +set OLDCOREAPI=microsoft-azure-core-api-old +set NEWCOREAPI=microsoft-azure-core-api-new +set NEWCOMPUTEMANAGEMENTAPI=microsoft-azure-management-compute-api-new +set NEWSQLMANAGEMENTAPI=microsoft-azure-management-sql-api-new +set NEWNETWORKMANAGEMENTAPI=microsoft-azure-management-network-api-new +set NEWSTORAGEMANAGEMENTAPI=microsoft-azure-management-storage-api-new +set NEWWEBSITEMANAGEMENTAPI=microsoft-azure-management-websites-api-new + +:: set the paths +set OLDBRANCHPATH=%OLDBRANCH%\microsoft-azure-api\src\main\java +set NEWRUNTIMEPATH=%NEWBRANCH%\serviceruntime\src\main\java +set NEWSERVICEBUSPATH=%NEWBRANCH%\servicebus\src\main\java +set NEWMEDIASERVICEPATH=%NEWBRANCH%\media\src\main\java +set NEWMANAGEMENTPATH=%NEWBRANCH%\management\src\main\java +set NEWCOREPATH=%NEWBRANCH%\core\src\main\java +set NEWCOMPUTEMANAGEMENTPATH=%NEWBRANCH%\management-compute\src\main\java +set NEWNETWORKMANAGEMENTPATH=%NEWBRANCH%\management-network\src\main\java +set NEWSQLMANAGEMENTPATH=%NEWBRANCH%\management-sql\src\main\java +set NEWSTORAGEMANAGEMENTPATH=%NEWBRANCH%\management-storage\src\main\java +set NEWWEBSITEMANAGEMENTPATH=%NEWBRANCH%\management-websites\src\main\java + +set OLDSERVICEBUSPATH=%OLDBRANCHPATH% + +:: set the namespace +set RUNTIMENAMESPACE=com.microsoft.windowsazure.serviceruntime +set OLDSERVICEBUSNAMESPACE=com.microsoft.windowsazure.services.serviceBus +set NEWSERVICEBUSNAMESPACE=com.microsoft.windowsazure.services.servicebus +set MEDIASERVICENAMESPACE=com.microsoft.windowsazure.services.media +set OLDMANAGEMENTNAMESPACE=com.microsoft.windowsazure.services.management +set NEWMANAGEMENTNAMESPACE=com.microsoft.windowsazure.management +set OLDCORENAMESPACE=com.microsoft.windowsazure.services.core +set NEWCORENAMESPACE=com.microsoft.windowsazure.core +set NEWCOMPUTEMANAGEMENTNAMESPACE=com.microsoft.windowsazure.management.compute +set NEWNETWORKMANAGEMENTNAMESPACE=com.microsoft.windowsazure.management.network +set NEWSQLMANAGEMENTNAMESPACE=com.microsoft.windowsazure.management.sql +set NEWSTORAGEMANAGEMENTNAMESPACE=com.microsoft.windowsazure.management.storage +set NEWWEBSITEMANAGEMENTNAMESPACE=com.microsoft.windowsazure.management.websites + +:: First, generate the javadoc for the old code. +:: Service Bus +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %OLDSERVICEBUSAPI% -sourcepath %OLDSERVICEBUSPATH% %OLDSERVICEBUSNAMESPACE% +:: Media Services +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %OLDMEDIASERVICEAPI% -sourcepath %OLDBRANCHPATH% %MEDIASERVICENAMESPACE% +:: Service Runtime +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %OLDRUNTIMEAPI% -sourcepath %OLDBRANCHPATH% %RUNTIMENAMESPACE% +:: Management +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %OLDMANAGEMENTAPI% -sourcepath %OLDBRANCHPATH% %OLDMANAGEMENTNAMESPACE% +:: Core +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %OLDCOREAPI% -sourcepath %OLDBRANCHPATH% %OLDCORENAMESPACE% + +:: Second, generate the java doc for the new code. +:: Service Bus +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %NEWSERVICEBUSAPI% -sourcepath %NEWSERVICEBUSPATH% %NEWSERVICEBUSNAMESPACE% +:: Media Services +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %NEWMEDIASERVICEAPI% -sourcepath %NEWMEDIASERVICEPATH% %MEDIASERVICENAMESPACE% +:: Service Runtime +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %NEWRUNTIMEAPI% -sourcepath %NEWRUNTIMEPATH% %RUNTIMENAMESPACE% +:: Management +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %NEWMANAGEMENTAPI% -sourcepath %NEWMANAGEMENTPATH% %NEWMANAGEMENTNAMESPACE% +:: Core +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %NEWCOREAPI% -sourcepath %NEWCOREPATH% %NEWCORENAMESPACE% + +:: Compute Management +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %NEWCOMPUTEMANAGEMENTAPI% -sourcepath %NEWCOMPUTEMANAGEMENTPATH% %NEWCOMPUTEMANAGEMENTNAMESPACE% + +:: Network Management +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %NEWNETWORKMANAGEMENTAPI% -sourcepath %NEWNETWORKMANAGEMENTPATH% %NEWNETWORKMANAGEMENTNAMESPACE% + +:: SQL Management +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %NEWSQLMANAGEMENTAPI% -sourcepath %NEWSQLMANAGEMENTPATH% %NEWSQLMANAGEMENTNAMESPACE% + +:: Storage Management +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %NEWSTORAGEMANAGEMENTAPI% -sourcepath %NEWSTORAGEMANAGEMENTPATH% %NEWSTORAGEMANAGEMENTNAMESPACE% + +:: Website Management +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -apiname %NEWWEBSITEMANAGEMENTAPI% -sourcepath %NEWWEBSITEMANAGEMENTPATH% %NEWWEBSITEMANAGEMENTNAMESPACE% + + +:: Third, create the sub directory +:: Service Runtime +set RUNTIMEOUTPUT=jdiff\serviceruntime +mkdir %RUNTIMEOUTPUT% +:: Service Bus +set SERVICEBUSOUTPUT=jdiff\servicebus +mkdir %SERVICEBUSOUTPUT% +:: Media Services +set MEDIASERVICEOUTPUT=jdiff\mediaservice +mkdir %MEDIASERVICEOUTPUT% +:: Management +set MANAGEMENTOUTPUT=jdiff\management +mkdir %MANAGEMENTOUTPUT% +:: Core +set COREOUTPUT=jdiff\core +mkdir %COREOUTPUT% + +:: Fourth, perform the jdiff comparison +:: service bus +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -d %SERVICEBUSOUTPUT% -stats -oldapi %OLDSERVICEBUSAPI% -newapi %NEWSERVICEBUSAPI% d:\software\jdiff\Null.java +:: runtime +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -d %RUNTIMEOUTPUT% -stats -oldapi %OLDRUNTIMEAPI% -newapi %NEWRUNTIMEAPI% d:\software\jdiff\Null.java +:: media service +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -d %MEDIASERVICEOUTPUT% -stats -oldapi %OLDMEDIASERVICEAPI% -newapi %NEWMEDIASERVICEAPI% d:\software\jdiff\Null.java +:: management +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -d %MANAGEMENTOUTPUT% -stats -oldapi %OLDMANAGEMENTAPI% -newapi %NEWMANAGEMENTAPI% d:\software\jdiff\Null.java +:: core +javadoc -doclet jdiff.JDiff -docletpath %JDIFF% -d %COREOUTPUT% -stats -oldapi %OLDCOREAPI% -newapi %NEWCOREAPI% d:\software\jdiff\Null.java + diff --git a/batch/data-plane/tools/suppressions.xml b/batch/data-plane/tools/suppressions.xml new file mode 100644 index 000000000000..690bb7a9fc35 --- /dev/null +++ b/batch/data-plane/tools/suppressions.xml @@ -0,0 +1,36 @@ + + + + + + + + + \ No newline at end of file diff --git a/eng/spotbugs-aggregate-report/pom.xml b/eng/spotbugs-aggregate-report/pom.xml index 590e8faf5e31..a7168da7d65b 100644 --- a/eng/spotbugs-aggregate-report/pom.xml +++ b/eng/spotbugs-aggregate-report/pom.xml @@ -15,6 +15,7 @@ 1.2.0 + 5.0.1 @@ -43,6 +44,11 @@ azure-keyvault-webkey ${azure-keyvault.version} + + com.microsoft.azure + azure-batch + ${azure-batch.version} + @@ -64,6 +70,7 @@ ..\..\keyvault\data-plane\azure-keyvault-core\src\main\java ..\..\keyvault\data-plane\azure-keyvault-webkey\src\main\java ..\..\keyvault\data-plane\azure-keyvault-extensions\src\main\java + ..\..\batch\data-plane\src\main\java diff --git a/keyvault/data-plane/pom.xml b/keyvault/data-plane/pom.xml index 32d24fbed347..6dba1bed4afc 100644 --- a/keyvault/data-plane/pom.xml +++ b/keyvault/data-plane/pom.xml @@ -19,7 +19,7 @@ Microsoft Azure Key Vault SDK Parent This package contains the parent module of Microsoft Azure Key Vault SDK. - https://github.com/Azure/azure-keyvault-java + https://github.com/Azure/azure-sdk-for-java @@ -30,8 +30,8 @@ - scm:git:https://github.com/Azure/azure-keyvault-java - scm:git:git@github.com:Azure/azure-keyvault-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/pom.client.xml b/pom.client.xml index 8cca7638e65c..ed37aa84b2ec 100644 --- a/pom.client.xml +++ b/pom.client.xml @@ -82,7 +82,7 @@ 2.9.6 - 1.3.0 + 1.6.4 1.6.1 1.10 3.1.11 @@ -95,7 +95,7 @@ 1.3.1-SNAPSHOT 1.3.0 1.3.0 - 4.4.0 + 8.0.0 1.6.3 @@ -117,6 +117,7 @@ 1.0 3.7.1 3.0.0 + 2.4 @@ -129,6 +130,12 @@ ${azure-client-runtime.version} + + com.microsoft.azure + adal4j + ${adal4j.version} + + com.microsoft.rest @@ -187,13 +194,6 @@ test - - com.microsoft.azure - adal4j - ${adal4j.version} - test - - org.bouncycastle bcprov-jdk15on @@ -221,6 +221,13 @@ test + + commons-io + commons-io + ${commons-io.version} + test + + @@ -359,6 +366,9 @@ com.microsoft.azure.keyvault* + + + false @@ -621,6 +631,7 @@ spotbugs-reporting ./template/client + ./batch/data-plane ./keyvault/data-plane ./eng/spotbugs-aggregate-report @@ -629,8 +640,9 @@ ./template/client - ./keyvault/data-plane ./eng/code-quality-reports + ./batch/data-plane + ./keyvault/data-plane \ No newline at end of file