Skip to content
Merged
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
Expand Up @@ -13,14 +13,16 @@
import com.microsoft.azure.arm.resources.models.GroupableResourceCore;
import com.microsoft.azure.arm.resources.models.HasResourceGroup;
import com.microsoft.azure.arm.model.Refreshable;
import com.microsoft.azure.arm.model.Updatable;
import com.microsoft.azure.arm.model.Appliable;
import com.microsoft.azure.arm.resources.models.HasManager;
import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.implementation.HanaOnAzureManager;
import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.implementation.HanaInstanceInner;

/**
* Type representing HanaInstance.
*/
public interface HanaInstance extends HasInner<HanaInstanceInner>, Resource, GroupableResourceCore<HanaOnAzureManager, HanaInstanceInner>, HasResourceGroup, Refreshable<HanaInstance>, HasManager<HanaOnAzureManager> {
public interface HanaInstance extends HasInner<HanaInstanceInner>, Resource, GroupableResourceCore<HanaOnAzureManager, HanaInstanceInner>, HasResourceGroup, Refreshable<HanaInstance>, Updatable<HanaInstance.Update>, HasManager<HanaOnAzureManager> {
/**
* @return the hanaInstanceId value.
*/
Expand Down Expand Up @@ -51,4 +53,15 @@ public interface HanaInstance extends HasInner<HanaInstanceInner>, Resource, Gro
*/
StorageProfile storageProfile();

/**
* The template for a HanaInstance update operation, containing all the settings that can be modified.
*/
interface Update extends Appliable<HanaInstance>, Resource.UpdateWithTags<Update> {
}

/**
* Grouping of HanaInstance update stages.
*/
interface UpdateStages {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/

package com.microsoft.azure.management.hanaonazure.v2017_11_03_preview;

import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Tags field of the HANA instance.
*/
public class Tags {
/**
* Tags field of the HANA instance.
*/
@JsonProperty(value = "tags")
private Map<String, String> tags;

/**
* Get tags field of the HANA instance.
*
* @return the tags value
*/
public Map<String, String> tags() {
return this.tags;
}

/**
* Set tags field of the HANA instance.
*
* @param tags the tags value to set
* @return the Tags object itself.
*/
public Tags withTags(Map<String, String> tags) {
this.tags = tags;
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.HanaInstancePowerStateEnum;
import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.StorageProfile;

class HanaInstanceImpl extends GroupableResourceCoreImpl<HanaInstance, HanaInstanceInner, HanaInstanceImpl, HanaOnAzureManager> implements HanaInstance {
class HanaInstanceImpl extends GroupableResourceCoreImpl<HanaInstance, HanaInstanceInner, HanaInstanceImpl, HanaOnAzureManager> implements HanaInstance, HanaInstance.Update {
HanaInstanceImpl(String name, HanaInstanceInner inner, HanaOnAzureManager manager) {
super(name, inner, manager);
}
Expand All @@ -31,7 +31,8 @@ public Observable<HanaInstance> createResourceAsync() {
@Override
public Observable<HanaInstance> updateResourceAsync() {
HanaInstancesInner client = this.manager().inner().hanaInstances();
return null; // NOP updateResourceAsync implementation as update is not supported
return client.updateAsync(this.resourceGroupName(), this.name())
.map(innerToFluentMap(this));
}

@Override
Expand All @@ -40,6 +41,10 @@ protected Observable<HanaInstanceInner> getInnerAsync() {
return client.getByResourceGroupAsync(this.resourceGroupName(), this.name());
}

@Override
public boolean isInCreateMode() {
return this.inner().id() == null;
}


@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,22 @@
import com.microsoft.azure.CloudException;
import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.ErrorResponseException;
import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.Tags;
import com.microsoft.azure.Page;
import com.microsoft.azure.PagedList;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.Validator;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.PATCH;
import retrofit2.http.Path;
import retrofit2.http.POST;
import retrofit2.http.Query;
Expand Down Expand Up @@ -73,6 +78,10 @@ interface HanaInstancesService {
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}")
Observable<Response<ResponseBody>> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("hanaInstanceName") String hanaInstanceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.HanaInstances update" })
@PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}")
Observable<Response<ResponseBody>> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("hanaInstanceName") String hanaInstanceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body Tags tagsParameter, @Header("User-Agent") String userAgent);

@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.HanaInstances restart" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/restart")
Observable<Response<ResponseBody>> restart(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("hanaInstanceName") String hanaInstanceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
Expand Down Expand Up @@ -409,6 +418,189 @@ private ServiceResponse<HanaInstanceInner> getByResourceGroupDelegate(Response<R
.build(response);
}

/**
* Patches the Tags field of a SAP HANA instance.
* Patches the Tags field of a SAP HANA instance for the specified subscription, resource group, and instance name.
*
* @param resourceGroupName Name of the resource group.
* @param hanaInstanceName Name of the SAP HANA on Azure instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the HanaInstanceInner object if successful.
*/
public HanaInstanceInner update(String resourceGroupName, String hanaInstanceName) {
return updateWithServiceResponseAsync(resourceGroupName, hanaInstanceName).toBlocking().single().body();
}

/**
* Patches the Tags field of a SAP HANA instance.
* Patches the Tags field of a SAP HANA instance for the specified subscription, resource group, and instance name.
*
* @param resourceGroupName Name of the resource group.
* @param hanaInstanceName Name of the SAP HANA on Azure instance.
* @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<HanaInstanceInner> updateAsync(String resourceGroupName, String hanaInstanceName, final ServiceCallback<HanaInstanceInner> serviceCallback) {
return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, hanaInstanceName), serviceCallback);
}

/**
* Patches the Tags field of a SAP HANA instance.
* Patches the Tags field of a SAP HANA instance for the specified subscription, resource group, and instance name.
*
* @param resourceGroupName Name of the resource group.
* @param hanaInstanceName Name of the SAP HANA on Azure instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the HanaInstanceInner object
*/
public Observable<HanaInstanceInner> updateAsync(String resourceGroupName, String hanaInstanceName) {
return updateWithServiceResponseAsync(resourceGroupName, hanaInstanceName).map(new Func1<ServiceResponse<HanaInstanceInner>, HanaInstanceInner>() {
@Override
public HanaInstanceInner call(ServiceResponse<HanaInstanceInner> response) {
return response.body();
}
});
}

/**
* Patches the Tags field of a SAP HANA instance.
* Patches the Tags field of a SAP HANA instance for the specified subscription, resource group, and instance name.
*
* @param resourceGroupName Name of the resource group.
* @param hanaInstanceName Name of the SAP HANA on Azure instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the HanaInstanceInner object
*/
public Observable<ServiceResponse<HanaInstanceInner>> updateWithServiceResponseAsync(String resourceGroupName, String hanaInstanceName) {
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 (hanaInstanceName == null) {
throw new IllegalArgumentException("Parameter hanaInstanceName 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 Map<String, String> tags = null;
Tags tagsParameter = new Tags();
tagsParameter.withTags(null);
return service.update(this.client.subscriptionId(), resourceGroupName, hanaInstanceName, this.client.apiVersion(), this.client.acceptLanguage(), tagsParameter, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<HanaInstanceInner>>>() {
@Override
public Observable<ServiceResponse<HanaInstanceInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<HanaInstanceInner> clientResponse = updateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

/**
* Patches the Tags field of a SAP HANA instance.
* Patches the Tags field of a SAP HANA instance for the specified subscription, resource group, and instance name.
*
* @param resourceGroupName Name of the resource group.
* @param hanaInstanceName Name of the SAP HANA on Azure instance.
* @param tags Tags field of the HANA instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the HanaInstanceInner object if successful.
*/
public HanaInstanceInner update(String resourceGroupName, String hanaInstanceName, Map<String, String> tags) {
return updateWithServiceResponseAsync(resourceGroupName, hanaInstanceName, tags).toBlocking().single().body();
}

/**
* Patches the Tags field of a SAP HANA instance.
* Patches the Tags field of a SAP HANA instance for the specified subscription, resource group, and instance name.
*
* @param resourceGroupName Name of the resource group.
* @param hanaInstanceName Name of the SAP HANA on Azure instance.
* @param tags Tags field of the HANA instance.
* @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<HanaInstanceInner> updateAsync(String resourceGroupName, String hanaInstanceName, Map<String, String> tags, final ServiceCallback<HanaInstanceInner> serviceCallback) {
return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, hanaInstanceName, tags), serviceCallback);
}

/**
* Patches the Tags field of a SAP HANA instance.
* Patches the Tags field of a SAP HANA instance for the specified subscription, resource group, and instance name.
*
* @param resourceGroupName Name of the resource group.
* @param hanaInstanceName Name of the SAP HANA on Azure instance.
* @param tags Tags field of the HANA instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the HanaInstanceInner object
*/
public Observable<HanaInstanceInner> updateAsync(String resourceGroupName, String hanaInstanceName, Map<String, String> tags) {
return updateWithServiceResponseAsync(resourceGroupName, hanaInstanceName, tags).map(new Func1<ServiceResponse<HanaInstanceInner>, HanaInstanceInner>() {
@Override
public HanaInstanceInner call(ServiceResponse<HanaInstanceInner> response) {
return response.body();
}
});
}

/**
* Patches the Tags field of a SAP HANA instance.
* Patches the Tags field of a SAP HANA instance for the specified subscription, resource group, and instance name.
*
* @param resourceGroupName Name of the resource group.
* @param hanaInstanceName Name of the SAP HANA on Azure instance.
* @param tags Tags field of the HANA instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the HanaInstanceInner object
*/
public Observable<ServiceResponse<HanaInstanceInner>> updateWithServiceResponseAsync(String resourceGroupName, String hanaInstanceName, Map<String, String> tags) {
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 (hanaInstanceName == null) {
throw new IllegalArgumentException("Parameter hanaInstanceName 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(tags);
Tags tagsParameter = new Tags();
tagsParameter.withTags(tags);
return service.update(this.client.subscriptionId(), resourceGroupName, hanaInstanceName, this.client.apiVersion(), this.client.acceptLanguage(), tagsParameter, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<HanaInstanceInner>>>() {
@Override
public Observable<ServiceResponse<HanaInstanceInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<HanaInstanceInner> clientResponse = updateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

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

/**
* The operation to restart a SAP HANA instance.
*
Expand Down