Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.
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 @@ -8,6 +8,7 @@

package com.microsoft.azure.management.sql.v2017_10_01_preview;

import rx.Completable;
import rx.Observable;
import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedInstanceEncryptionProtectorInner;
import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedInstanceEncryptionProtectorsInner;
Expand All @@ -17,6 +18,16 @@
* Type representing ManagedInstanceEncryptionProtectors.
*/
public interface ManagedInstanceEncryptionProtectors extends HasInner<ManagedInstanceEncryptionProtectorsInner> {
/**
* Revalidates an existing encryption protector.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param managedInstanceName The name of the managed instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
Completable revalidateAsync(String resourceGroupName, String managedInstanceName);

/**
* Gets a list of managed instance encryption protectors.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors;
import rx.Completable;
import rx.functions.Func1;
import rx.Observable;
import com.microsoft.azure.Page;
Expand All @@ -28,6 +29,12 @@ public SqlManager manager() {
return this.manager;
}

@Override
public Completable revalidateAsync(String resourceGroupName, String managedInstanceName) {
ManagedInstanceEncryptionProtectorsInner client = this.inner();
return client.revalidateAsync(resourceGroupName, managedInstanceName).toCompletable();
}

@Override
public Observable<ManagedInstanceEncryptionProtector> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) {
ManagedInstanceEncryptionProtectorsInner client = this.inner();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Path;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Query;
import retrofit2.http.Url;
Expand Down Expand Up @@ -60,6 +61,14 @@ public ManagedInstanceEncryptionProtectorsInner(Retrofit retrofit, SqlManagement
* used by Retrofit to perform actually REST calls.
*/
interface ManagedInstanceEncryptionProtectorsService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors revalidate" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}/revalidate")
Observable<Response<ResponseBody>> revalidate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("encryptionProtectorName") String encryptionProtectorName, @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", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors beginRevalidate" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}/revalidate")
Observable<Response<ResponseBody>> beginRevalidate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("encryptionProtectorName") String encryptionProtectorName, @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", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors listByInstance" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector")
Observable<Response<ResponseBody>> listByInstance(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
Expand All @@ -82,6 +91,162 @@ interface ManagedInstanceEncryptionProtectorsService {

}

/**
* Revalidates an existing encryption protector.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param managedInstanceName The name of the managed instance.
* @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
*/
public void revalidate(String resourceGroupName, String managedInstanceName) {
revalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().last().body();
}

/**
* Revalidates an existing encryption protector.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param managedInstanceName The name of the managed 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<Void> revalidateAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(revalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback);
}

/**
* Revalidates an existing encryption protector.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param managedInstanceName The name of the managed instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<Void> revalidateAsync(String resourceGroupName, String managedInstanceName) {
return revalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}

/**
* Revalidates an existing encryption protector.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param managedInstanceName The name of the managed instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<ServiceResponse<Void>> revalidateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (managedInstanceName == null) {
throw new IllegalArgumentException("Parameter managedInstanceName 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.");
}
final String encryptionProtectorName = "current";
Observable<Response<ResponseBody>> observable = service.revalidate(resourceGroupName, managedInstanceName, encryptionProtectorName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent());
return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType());
}

/**
* Revalidates an existing encryption protector.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param managedInstanceName The name of the managed instance.
* @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
*/
public void beginRevalidate(String resourceGroupName, String managedInstanceName) {
beginRevalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body();
}

/**
* Revalidates an existing encryption protector.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param managedInstanceName The name of the managed 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<Void> beginRevalidateAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(beginRevalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback);
}

/**
* Revalidates an existing encryption protector.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param managedInstanceName The name of the managed instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<Void> beginRevalidateAsync(String resourceGroupName, String managedInstanceName) {
return beginRevalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}

/**
* Revalidates an existing encryption protector.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param managedInstanceName The name of the managed instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> beginRevalidateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (managedInstanceName == null) {
throw new IllegalArgumentException("Parameter managedInstanceName 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.");
}
final String encryptionProtectorName = "current";
return service.beginRevalidate(resourceGroupName, managedInstanceName, encryptionProtectorName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = beginRevalidateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

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

/**
* Gets a list of managed instance encryption protectors.
*
Expand Down