com.microsoft.azure.management.batch.implementation.ApplicationPackagesInner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-mgmt-batch Show documentation
Show all versions of azure-mgmt-batch Show documentation
This package contains Microsoft Azure Batch Account Management SDK. This package has been deprecated. A replacement package com.azure.resourcemanager:azure-resourcemanager-batch is available as of 31-March-2022. We strongly encourage you to upgrade to continue receiving updates. See Migration Guide https://aka.ms/java-track2-migration-guide for guidance on upgrading. Refer to our deprecation policy https://azure.github.io/azure-sdk/policies_support.html for more details.
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.batch.implementation;
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceResponseBuilder;
import com.microsoft.azure.CloudException;
import com.microsoft.azure.management.batch.ActivateApplicationPackageParameters;
import com.microsoft.rest.ServiceCall;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceResponse;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.HTTP;
import retrofit2.http.Path;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Query;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;
/**
* An instance of this class provides access to all the operations defined
* in ApplicationPackages.
*/
public final class ApplicationPackagesInner {
/** The Retrofit service to perform REST calls. */
private ApplicationPackagesService service;
/** The service client containing this operation class. */
private BatchManagementClientImpl client;
/**
* Initializes an instance of ApplicationPackagesInner.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public ApplicationPackagesInner(Retrofit retrofit, BatchManagementClientImpl client) {
this.service = retrofit.create(ApplicationPackagesService.class);
this.client = client;
}
/**
* The interface defining all the services for ApplicationPackages to be
* used by Retrofit to perform actually REST calls.
*/
interface ApplicationPackagesService {
@Headers("Content-Type: application/json; charset=utf-8")
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}/activate")
Observable> activate(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("version") String version, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ActivateApplicationPackageParameters parameters, @Header("User-Agent") String userAgent);
@Headers("Content-Type: application/json; charset=utf-8")
@PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}")
Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("version") String version, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers("Content-Type: application/json; charset=utf-8")
@HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", method = "DELETE", hasBody = true)
Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("version") String version, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers("Content-Type: application/json; charset=utf-8")
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}")
Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("version") String version, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
}
/**
* Activates the specified application package.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application to activate.
* @param format The format of the application package binary file.
*/
public void activate(String resourceGroupName, String accountName, String applicationId, String version, String format) {
activateWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version, format).toBlocking().single().getBody();
}
/**
* Activates the specified application package.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application to activate.
* @param format The format of the application package binary file.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
*/
public ServiceCall activateAsync(String resourceGroupName, String accountName, String applicationId, String version, String format, final ServiceCallback serviceCallback) {
return ServiceCall.create(activateWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version, format), serviceCallback);
}
/**
* Activates the specified application package.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application to activate.
* @param format The format of the application package binary file.
* @return the {@link ServiceResponse} object if successful.
*/
public Observable activateAsync(String resourceGroupName, String accountName, String applicationId, String version, String format) {
return activateWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version, format).map(new Func1, Void>() {
@Override
public Void call(ServiceResponse response) {
return response.getBody();
}
});
}
/**
* Activates the specified application package.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application to activate.
* @param format The format of the application package binary file.
* @return the {@link ServiceResponse} object if successful.
*/
public Observable> activateWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId, String version, String format) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (applicationId == null) {
throw new IllegalArgumentException("Parameter applicationId is required and cannot be null.");
}
if (version == null) {
throw new IllegalArgumentException("Parameter version is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (format == null) {
throw new IllegalArgumentException("Parameter format is required and cannot be null.");
}
ActivateApplicationPackageParameters parameters = new ActivateApplicationPackageParameters();
parameters.withFormat(format);
return service.activate(resourceGroupName, accountName, applicationId, version, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = activateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse activateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder(this.client.mapperAdapter())
.register(204, new TypeToken() { }.getType())
.build(response);
}
/**
* Creates an application package record.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application.
* @return the ApplicationPackageInner object if successful.
*/
public ApplicationPackageInner create(String resourceGroupName, String accountName, String applicationId, String version) {
return createWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).toBlocking().single().getBody();
}
/**
* Creates an application package record.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
*/
public ServiceCall createAsync(String resourceGroupName, String accountName, String applicationId, String version, final ServiceCallback serviceCallback) {
return ServiceCall.create(createWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version), serviceCallback);
}
/**
* Creates an application package record.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application.
* @return the observable to the ApplicationPackageInner object
*/
public Observable createAsync(String resourceGroupName, String accountName, String applicationId, String version) {
return createWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).map(new Func1, ApplicationPackageInner>() {
@Override
public ApplicationPackageInner call(ServiceResponse response) {
return response.getBody();
}
});
}
/**
* Creates an application package record.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application.
* @return the observable to the ApplicationPackageInner object
*/
public Observable> createWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId, String version) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (applicationId == null) {
throw new IllegalArgumentException("Parameter applicationId is required and cannot be null.");
}
if (version == null) {
throw new IllegalArgumentException("Parameter version is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.create(resourceGroupName, accountName, applicationId, version, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = createDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder(this.client.mapperAdapter())
.register(201, new TypeToken() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Deletes an application package record and its associated binary file.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application to delete.
*/
public void delete(String resourceGroupName, String accountName, String applicationId, String version) {
deleteWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).toBlocking().single().getBody();
}
/**
* Deletes an application package record and its associated binary file.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application to delete.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
*/
public ServiceCall deleteAsync(String resourceGroupName, String accountName, String applicationId, String version, final ServiceCallback serviceCallback) {
return ServiceCall.create(deleteWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version), serviceCallback);
}
/**
* Deletes an application package record and its associated binary file.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application to delete.
* @return the {@link ServiceResponse} object if successful.
*/
public Observable deleteAsync(String resourceGroupName, String accountName, String applicationId, String version) {
return deleteWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).map(new Func1, Void>() {
@Override
public Void call(ServiceResponse response) {
return response.getBody();
}
});
}
/**
* Deletes an application package record and its associated binary file.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application to delete.
* @return the {@link ServiceResponse} object if successful.
*/
public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId, String version) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (applicationId == null) {
throw new IllegalArgumentException("Parameter applicationId is required and cannot be null.");
}
if (version == null) {
throw new IllegalArgumentException("Parameter version is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.delete(resourceGroupName, accountName, applicationId, version, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = deleteDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder(this.client.mapperAdapter())
.register(204, new TypeToken() { }.getType())
.build(response);
}
/**
* Gets information about the specified application package.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application.
* @return the ApplicationPackageInner object if successful.
*/
public ApplicationPackageInner get(String resourceGroupName, String accountName, String applicationId, String version) {
return getWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).toBlocking().single().getBody();
}
/**
* Gets information about the specified application package.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
*/
public ServiceCall getAsync(String resourceGroupName, String accountName, String applicationId, String version, final ServiceCallback serviceCallback) {
return ServiceCall.create(getWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version), serviceCallback);
}
/**
* Gets information about the specified application package.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application.
* @return the observable to the ApplicationPackageInner object
*/
public Observable getAsync(String resourceGroupName, String accountName, String applicationId, String version) {
return getWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).map(new Func1, ApplicationPackageInner>() {
@Override
public ApplicationPackageInner call(ServiceResponse response) {
return response.getBody();
}
});
}
/**
* Gets information about the specified application package.
*
* @param resourceGroupName The name of the resource group that contains the Batch account.
* @param accountName The name of the Batch account.
* @param applicationId The id of the application.
* @param version The version of the application.
* @return the observable to the ApplicationPackageInner object
*/
public Observable> getWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId, String version) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (applicationId == null) {
throw new IllegalArgumentException("Parameter applicationId is required and cannot be null.");
}
if (version == null) {
throw new IllegalArgumentException("Parameter version is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.get(resourceGroupName, accountName, applicationId, version, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = getDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder(this.client.mapperAdapter())
.register(200, new TypeToken() { }.getType())
.registerError(CloudException.class)
.build(response);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy