Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR] containerinstance/resource-manager #262

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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 = "rows")
private Integer rows;

/**
* The column size of the terminal.
*/
@JsonProperty(value = "cols")
private Integer cols;

/**
* Get the rows value.
*
* @return the rows value
*/
public Integer rows() {
return this.rows;
}

/**
* Set the rows value.
*
* @param rows the rows value to set
* @return the ContainerExecRequestTerminalSize object itself.
*/
public ContainerExecRequestTerminalSize withRows(Integer rows) {
this.rows = rows;
return this;
}

/**
* Get the cols value.
*
* @return the cols value
*/
public Integer cols() {
return this.cols;
}

/**
* Set the cols value.
*
* @param cols the cols value to set
* @return the ContainerExecRequestTerminalSize object itself.
*/
public ContainerExecRequestTerminalSize withCols(Integer cols) {
this.cols = cols;
return this;
}

}
Original file line number Diff line number Diff line change
@@ -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;
}

}
Original file line number Diff line number Diff line change
@@ -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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ interface ContainerGroupsService {
@PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}")
Observable<Response<ResponseBody>> 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<Response<ResponseBody>> 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<Response<ResponseBody>> 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);
Expand Down Expand Up @@ -435,7 +439,7 @@ private ServiceResponse<ContainerGroupInner> 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();
}

/**
Expand All @@ -461,7 +465,7 @@ public ServiceFuture<ContainerGroupInner> 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<ContainerGroupInner> createOrUpdateAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() {
Expand All @@ -480,7 +484,7 @@ public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> 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<ServiceResponse<ContainerGroupInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) {
if (this.client.subscriptionId() == null) {
Expand All @@ -499,68 +503,53 @@ public Observable<ServiceResponse<ContainerGroupInner>> 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<Response<ResponseBody>, Observable<ServiceResponse<ContainerGroupInner>>>() {
@Override
public Observable<ServiceResponse<ContainerGroupInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ContainerGroupInner> clientResponse = createOrUpdateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

private ServiceResponse<ContainerGroupInner> createOrUpdateDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<ContainerGroupInner, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<ContainerGroupInner>() { }.getType())
.register(201, new TypeToken<ContainerGroupInner>() { }.getType())
.registerError(CloudException.class)
.build(response);
Observable<Response<ResponseBody>> 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<ContainerGroupInner>() { }.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<ContainerGroupInner> updateAsync(String resourceGroupName, String containerGroupName, final ServiceCallback<ContainerGroupInner> serviceCallback) {
return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, containerGroupName), serviceCallback);
public ServiceFuture<ContainerGroupInner> beginCreateOrUpdateAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup, final ServiceCallback<ContainerGroupInner> 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<ContainerGroupInner> updateAsync(String resourceGroupName, String containerGroupName) {
return updateWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() {
public Observable<ContainerGroupInner> beginCreateOrUpdateAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() {
@Override
public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) {
return response.body();
Expand All @@ -569,15 +558,16 @@ public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> 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<ServiceResponse<ContainerGroupInner>> updateWithServiceResponseAsync(String resourceGroupName, String containerGroupName) {
public Observable<ServiceResponse<ContainerGroupInner>> 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.");
}
Expand All @@ -590,13 +580,16 @@ public Observable<ServiceResponse<ContainerGroupInner>> 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<Response<ResponseBody>, Observable<ServiceResponse<ContainerGroupInner>>>() {
@Override
public Observable<ServiceResponse<ContainerGroupInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ContainerGroupInner> clientResponse = updateDelegate(response);
ServiceResponse<ContainerGroupInner> clientResponse = beginCreateOrUpdateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
Expand All @@ -605,6 +598,14 @@ public Observable<ServiceResponse<ContainerGroupInner>> call(Response<ResponseBo
});
}

private ServiceResponse<ContainerGroupInner> beginCreateOrUpdateDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<ContainerGroupInner, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<ContainerGroupInner>() { }.getType())
.register(201, new TypeToken<ContainerGroupInner>() { }.getType())
.registerError(CloudException.class)
.build(response);
}

/**
* Update container groups.
* Updates container group tags with specified values.
Expand Down Expand Up @@ -678,6 +679,9 @@ public Observable<ServiceResponse<ContainerGroupInner>> 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<Response<ResponseBody>, Observable<ServiceResponse<ContainerGroupInner>>>() {
Expand Down
Loading