From 87c664e9f15cfbfd8f836f2c6857481086a34a07 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 12 Mar 2018 18:12:27 +0000 Subject: [PATCH] Generated from 9fecbb9feb0b8ea3cbba6a02e84973b2bdf11378 remvoing extra async operations --- .../ContainerExecRequestTerminalSize.java | 69 ++++++++ .../ContainerExecRequestInner.java | 70 ++++++++ .../ContainerExecResponseInner.java | 69 ++++++++ .../implementation/ContainerGroupsInner.java | 86 ++++----- ...ContainerInstanceManagementClientImpl.java | 14 ++ .../implementation/StartContainersInner.java | 167 ++++++++++++++++++ 6 files changed, 434 insertions(+), 41 deletions(-) create mode 100644 azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/ContainerExecRequestTerminalSize.java create mode 100644 azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerExecRequestInner.java create mode 100644 azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerExecResponseInner.java create mode 100644 azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/StartContainersInner.java diff --git a/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/ContainerExecRequestTerminalSize.java b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/ContainerExecRequestTerminalSize.java new file mode 100644 index 00000000000..aa3620ba5ba --- /dev/null +++ b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/ContainerExecRequestTerminalSize.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerinstance; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The size of the terminal. + */ +public class ContainerExecRequestTerminalSize { + /** + * The row size of the terminal. + */ + @JsonProperty(value = "row") + private Integer row; + + /** + * The column size of the terminal. + */ + @JsonProperty(value = "column") + private Integer column; + + /** + * Get the row value. + * + * @return the row value + */ + public Integer row() { + return this.row; + } + + /** + * Set the row value. + * + * @param row the row value to set + * @return the ContainerExecRequestTerminalSize object itself. + */ + public ContainerExecRequestTerminalSize withRow(Integer row) { + this.row = row; + return this; + } + + /** + * Get the column value. + * + * @return the column value + */ + public Integer column() { + return this.column; + } + + /** + * Set the column value. + * + * @param column the column value to set + * @return the ContainerExecRequestTerminalSize object itself. + */ + public ContainerExecRequestTerminalSize withColumn(Integer column) { + this.column = column; + return this; + } + +} diff --git a/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerExecRequestInner.java b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerExecRequestInner.java new file mode 100644 index 00000000000..3db3910e4a4 --- /dev/null +++ b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerExecRequestInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerinstance.implementation; + +import com.microsoft.azure.management.containerinstance.ContainerExecRequestTerminalSize; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The start container exec request. + */ +public class ContainerExecRequestInner { + /** + * The command to be executed. + */ + @JsonProperty(value = "command") + private String command; + + /** + * The size of the terminal. + */ + @JsonProperty(value = "terminalSize") + private ContainerExecRequestTerminalSize terminalSize; + + /** + * Get the command value. + * + * @return the command value + */ + public String command() { + return this.command; + } + + /** + * Set the command value. + * + * @param command the command value to set + * @return the ContainerExecRequestInner object itself. + */ + public ContainerExecRequestInner withCommand(String command) { + this.command = command; + return this; + } + + /** + * Get the terminalSize value. + * + * @return the terminalSize value + */ + public ContainerExecRequestTerminalSize terminalSize() { + return this.terminalSize; + } + + /** + * Set the terminalSize value. + * + * @param terminalSize the terminalSize value to set + * @return the ContainerExecRequestInner object itself. + */ + public ContainerExecRequestInner withTerminalSize(ContainerExecRequestTerminalSize terminalSize) { + this.terminalSize = terminalSize; + return this; + } + +} diff --git a/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerExecResponseInner.java b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerExecResponseInner.java new file mode 100644 index 00000000000..ed9b5e9df3b --- /dev/null +++ b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerExecResponseInner.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerinstance.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The information for the container exec command. + */ +public class ContainerExecResponseInner { + /** + * The uri for the exec websocket. + */ + @JsonProperty(value = "webSocketUri") + private String webSocketUri; + + /** + * The password to start the exec command. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get the webSocketUri value. + * + * @return the webSocketUri value + */ + public String webSocketUri() { + return this.webSocketUri; + } + + /** + * Set the webSocketUri value. + * + * @param webSocketUri the webSocketUri value to set + * @return the ContainerExecResponseInner object itself. + */ + public ContainerExecResponseInner withWebSocketUri(String webSocketUri) { + this.webSocketUri = webSocketUri; + 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 ContainerExecResponseInner object itself. + */ + public ContainerExecResponseInner withPassword(String password) { + this.password = password; + return this; + } + +} diff --git a/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerGroupsInner.java b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerGroupsInner.java index 497049ab7bc..20e9ef85cd2 100644 --- a/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerGroupsInner.java +++ b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerGroupsInner.java @@ -82,6 +82,10 @@ interface ContainerGroupsService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}") Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("containerGroupName") String containerGroupName, @Query("api-version") String apiVersion, @Body ContainerGroupInner containerGroup, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.ContainerGroups beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("containerGroupName") String containerGroupName, @Query("api-version") String apiVersion, @Body ContainerGroupInner containerGroup, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.ContainerGroups update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}") Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("containerGroupName") String containerGroupName, @Query("api-version") String apiVersion, @Body Resource resource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -435,7 +439,7 @@ private ServiceResponse getByResourceGroupDelegate(Response * @return the ContainerGroupInner object if successful. */ public ContainerGroupInner createOrUpdate(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { - return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).toBlocking().single().body(); + return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).toBlocking().last().body(); } /** @@ -461,7 +465,7 @@ public ServiceFuture createOrUpdateAsync(String resourceGro * @param containerGroupName The name of the container group. * @param containerGroup The properties of the container group to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ContainerGroupInner object + * @return the observable for the request */ public Observable createOrUpdateAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).map(new Func1, ContainerGroupInner>() { @@ -480,7 +484,7 @@ public ContainerGroupInner call(ServiceResponse response) { * @param containerGroupName The name of the container group. * @param containerGroup The properties of the container group to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ContainerGroupInner object + * @return the observable for the request */ public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { if (this.client.subscriptionId() == null) { @@ -499,68 +503,53 @@ public Observable> createOrUpdateWithServic throw new IllegalArgumentException("Parameter containerGroup is required and cannot be null."); } Validator.validate(containerGroup); - return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, containerGroupName, this.client.apiVersion(), containerGroup, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = createOrUpdateDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(201, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, containerGroupName, this.client.apiVersion(), containerGroup, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } /** - * Update container groups. - * Updates container group tags with specified values. + * Create or update container groups. + * Create or update container groups with specified configurations. * * @param resourceGroupName The name of the resource group. * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ContainerGroupInner object if successful. */ - public ContainerGroupInner update(String resourceGroupName, String containerGroupName) { - return updateWithServiceResponseAsync(resourceGroupName, containerGroupName).toBlocking().single().body(); + public ContainerGroupInner beginCreateOrUpdate(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).toBlocking().single().body(); } /** - * Update container groups. - * Updates container group tags with specified values. + * Create or update container groups. + * Create or update container groups with specified configurations. * * @param resourceGroupName The name of the resource group. * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String containerGroupName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, containerGroupName), serviceCallback); + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup), serviceCallback); } /** - * Update container groups. - * Updates container group tags with specified values. + * Create or update container groups. + * Create or update container groups with specified configurations. * * @param resourceGroupName The name of the resource group. * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ContainerGroupInner object */ - public Observable updateAsync(String resourceGroupName, String containerGroupName) { - return updateWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1, ContainerGroupInner>() { + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).map(new Func1, ContainerGroupInner>() { @Override public ContainerGroupInner call(ServiceResponse response) { return response.body(); @@ -569,15 +558,16 @@ public ContainerGroupInner call(ServiceResponse response) { } /** - * Update container groups. - * Updates container group tags with specified values. + * Create or update container groups. + * Create or update container groups with specified configurations. * * @param resourceGroupName The name of the resource group. * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ContainerGroupInner object */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String containerGroupName) { + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -590,13 +580,16 @@ public Observable> updateWithServiceRespons if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - final Resource resource = null; - return service.update(this.client.subscriptionId(), resourceGroupName, containerGroupName, this.client.apiVersion(), resource, this.client.acceptLanguage(), this.client.userAgent()) + if (containerGroup == null) { + throw new IllegalArgumentException("Parameter containerGroup is required and cannot be null."); + } + Validator.validate(containerGroup); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, containerGroupName, this.client.apiVersion(), containerGroup, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = updateDelegate(response); + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -605,6 +598,14 @@ public Observable> call(Response beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Update container groups. * Updates container group tags with specified values. @@ -678,6 +679,9 @@ public Observable> updateWithServiceRespons if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } + if (resource == null) { + throw new IllegalArgumentException("Parameter resource is required and cannot be null."); + } Validator.validate(resource); return service.update(this.client.subscriptionId(), resourceGroupName, containerGroupName, this.client.apiVersion(), resource, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { diff --git a/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerInstanceManagementClientImpl.java b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerInstanceManagementClientImpl.java index 40bb9c944cd..163ff9f350c 100644 --- a/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerInstanceManagementClientImpl.java +++ b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/ContainerInstanceManagementClientImpl.java @@ -184,6 +184,19 @@ public ContainerLogsInner containerLogs() { return this.containerLogs; } + /** + * The StartContainersInner object to access its operations. + */ + private StartContainersInner startContainers; + + /** + * Gets the StartContainersInner object to access its operations. + * @return the StartContainersInner object. + */ + public StartContainersInner startContainers() { + return this.startContainers; + } + /** * Initializes an instance of ContainerInstanceManagementClient client. * @@ -223,6 +236,7 @@ protected void initialize() { this.operations = new OperationsInner(restClient().retrofit(), this); this.containerGroupUsages = new ContainerGroupUsagesInner(restClient().retrofit(), this); this.containerLogs = new ContainerLogsInner(restClient().retrofit(), this); + this.startContainers = new StartContainersInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/StartContainersInner.java b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/StartContainersInner.java new file mode 100644 index 00000000000..ff0078a862d --- /dev/null +++ b/azure-mgmt-containerinstance/src/main/java/com/microsoft/azure/management/containerinstance/implementation/StartContainersInner.java @@ -0,0 +1,167 @@ +/** + * 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.containerinstance.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +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 StartContainers. + */ +public class StartContainersInner { + /** The Retrofit service to perform REST calls. */ + private StartContainersService service; + /** The service client containing this operation class. */ + private ContainerInstanceManagementClientImpl client; + + /** + * Initializes an instance of StartContainersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public StartContainersInner(Retrofit retrofit, ContainerInstanceManagementClientImpl client) { + this.service = retrofit.create(StartContainersService.class); + this.client = client; + } + + /** + * The interface defining all the services for StartContainers to be + * used by Retrofit to perform actually REST calls. + */ + interface StartContainersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.StartContainers launchExec" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec") + Observable> launchExec(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("containerGroupName") String containerGroupName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Body ContainerExecRequestInner containerExecRequest, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Starts the exec command for a specific container instance. + * Starts the exec command for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ContainerExecResponseInner object if successful. + */ + public ContainerExecResponseInner launchExec(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest) { + return launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).toBlocking().single().body(); + } + + /** + * Starts the exec command for a specific container instance. + * Starts the exec command for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @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 launchExecAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest), serviceCallback); + } + + /** + * Starts the exec command for a specific container instance. + * Starts the exec command for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ContainerExecResponseInner object + */ + public Observable launchExecAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest) { + return launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).map(new Func1, ContainerExecResponseInner>() { + @Override + public ContainerExecResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts the exec command for a specific container instance. + * Starts the exec command for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ContainerExecResponseInner object + */ + public Observable> launchExecWithServiceResponseAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (containerGroupName == null) { + throw new IllegalArgumentException("Parameter containerGroupName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName 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 (containerExecRequest == null) { + throw new IllegalArgumentException("Parameter containerExecRequest is required and cannot be null."); + } + Validator.validate(containerExecRequest); + return service.launchExec(this.client.subscriptionId(), resourceGroupName, containerGroupName, containerName, this.client.apiVersion(), containerExecRequest, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = launchExecDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse launchExecDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +}