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 sql/resource-manager] [DO NOT MERGE] Sensitivity labels: Disable/Enable recommended sensitivity labels #3369

Merged
merged 1 commit into from
Apr 16, 2019
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 @@ -32,6 +32,11 @@ public interface DatabasisServerSensitivityLabel extends HasInner<SensitivityLab
*/
String informationTypeId();

/**
* @return the isDisabled value.
*/
Boolean isDisabled();

/**
* @return the labelId value.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public interface DatabasisServerSensitivityLabelModel extends HasInner<Sensitivi
*/
String informationTypeId();

/**
* @return the isDisabled value.
*/
Boolean isDisabled();

/**
* @return the labelId value.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public interface SensitivityLabel extends HasInner<SensitivityLabelInner>, Index
*/
String informationTypeId();

/**
* @return the isDisabled value.
*/
Boolean isDisabled();

/**
* @return the labelId value.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,34 @@
* Type representing SensitivityLabels.
*/
public interface SensitivityLabels extends SupportsCreating<SensitivityLabel.DefinitionStages.Blank>, HasInner<SensitivityLabelsInner> {
/**
* Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns).
*
* @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 serverName The name of the server.
* @param databaseName The name of the database.
* @param schemaName The name of the schema.
* @param tableName The name of the table.
* @param columnName The name of the column.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
Completable enableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName);

/**
* Disables sensitivity recommendations on a given column.
*
* @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 serverName The name of the server.
* @param databaseName The name of the database.
* @param schemaName The name of the schema.
* @param tableName The name of the table.
* @param columnName The name of the column.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
Completable disableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName);

/**
* Gets the sensitivity label of a given column.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public String informationTypeId() {
return this.inner().informationTypeId();
}

@Override
public Boolean isDisabled() {
return this.inner().isDisabled();
}

@Override
public String labelId() {
return this.inner().labelId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public String informationTypeId() {
return this.inner().informationTypeId();
}

@Override
public Boolean isDisabled() {
return this.inner().isDisabled();
}

@Override
public String labelId() {
return this.inner().labelId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public RecommendedSensitivityLabelsInner(Retrofit retrofit, SqlManagementClientI
interface RecommendedSensitivityLabelsService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.RecommendedSensitivityLabels listByDatabase" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels")
Observable<Response<ResponseBody>> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("$skipToken") String skipToken, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
Observable<Response<ResponseBody>> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("includeDisabledRecommendations") Boolean includeDisabledRecommendations, @Query("$skipToken") String skipToken, @Query("$filter") String filter, @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_03_01_preview.RecommendedSensitivityLabels listByDatabaseNext" })
@GET
Expand Down Expand Up @@ -176,9 +176,10 @@ public Observable<ServiceResponse<Page<SensitivityLabelInner>>> listByDatabaseSi
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final Boolean includeDisabledRecommendations = null;
final String skipToken = null;
final String filter = null;
return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), skipToken, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), includeDisabledRecommendations, skipToken, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SensitivityLabelInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SensitivityLabelInner>>> call(Response<ResponseBody> response) {
Expand All @@ -198,15 +199,16 @@ public Observable<ServiceResponse<Page<SensitivityLabelInner>>> call(Response<Re
* @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 serverName The name of the server.
* @param databaseName The name of the database.
* @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not.
* @param skipToken the String value
* @param filter An OData filter expression that filters elements in the collection.
* @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 PagedList&lt;SensitivityLabelInner&gt; object if successful.
*/
public PagedList<SensitivityLabelInner> listByDatabase(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) {
ServiceResponse<Page<SensitivityLabelInner>> response = listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, skipToken, filter).toBlocking().single();
public PagedList<SensitivityLabelInner> listByDatabase(final String resourceGroupName, final String serverName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) {
ServiceResponse<Page<SensitivityLabelInner>> response = listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter).toBlocking().single();
return new PagedList<SensitivityLabelInner>(response.body()) {
@Override
public Page<SensitivityLabelInner> nextPage(String nextPageLink) {
Expand All @@ -221,15 +223,16 @@ public Page<SensitivityLabelInner> nextPage(String nextPageLink) {
* @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 serverName The name of the server.
* @param databaseName The name of the database.
* @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not.
* @param skipToken the String value
* @param filter An OData filter expression that filters elements in the collection.
* @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<List<SensitivityLabelInner>> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter, final ListOperationCallback<SensitivityLabelInner> serviceCallback) {
public ServiceFuture<List<SensitivityLabelInner>> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter, final ListOperationCallback<SensitivityLabelInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, skipToken, filter),
listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter),
new Func1<String, Observable<ServiceResponse<Page<SensitivityLabelInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SensitivityLabelInner>>> call(String nextPageLink) {
Expand All @@ -245,13 +248,14 @@ public Observable<ServiceResponse<Page<SensitivityLabelInner>>> call(String next
* @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 serverName The name of the server.
* @param databaseName The name of the database.
* @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not.
* @param skipToken the String value
* @param filter An OData filter expression that filters elements in the collection.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;SensitivityLabelInner&gt; object
*/
public Observable<Page<SensitivityLabelInner>> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) {
return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName, skipToken, filter)
public Observable<Page<SensitivityLabelInner>> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) {
return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter)
.map(new Func1<ServiceResponse<Page<SensitivityLabelInner>>, Page<SensitivityLabelInner>>() {
@Override
public Page<SensitivityLabelInner> call(ServiceResponse<Page<SensitivityLabelInner>> response) {
Expand All @@ -266,13 +270,14 @@ public Page<SensitivityLabelInner> call(ServiceResponse<Page<SensitivityLabelInn
* @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 serverName The name of the server.
* @param databaseName The name of the database.
* @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not.
* @param skipToken the String value
* @param filter An OData filter expression that filters elements in the collection.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;SensitivityLabelInner&gt; object
*/
public Observable<ServiceResponse<Page<SensitivityLabelInner>>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) {
return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, skipToken, filter)
public Observable<ServiceResponse<Page<SensitivityLabelInner>>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) {
return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter)
.concatMap(new Func1<ServiceResponse<Page<SensitivityLabelInner>>, Observable<ServiceResponse<Page<SensitivityLabelInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SensitivityLabelInner>>> call(ServiceResponse<Page<SensitivityLabelInner>> page) {
Expand All @@ -291,12 +296,13 @@ public Observable<ServiceResponse<Page<SensitivityLabelInner>>> call(ServiceResp
ServiceResponse<PageImpl<SensitivityLabelInner>> * @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.
ServiceResponse<PageImpl<SensitivityLabelInner>> * @param serverName The name of the server.
ServiceResponse<PageImpl<SensitivityLabelInner>> * @param databaseName The name of the database.
ServiceResponse<PageImpl<SensitivityLabelInner>> * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not.
ServiceResponse<PageImpl<SensitivityLabelInner>> * @param skipToken the String value
ServiceResponse<PageImpl<SensitivityLabelInner>> * @param filter An OData filter expression that filters elements in the collection.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList&lt;SensitivityLabelInner&gt; object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<SensitivityLabelInner>>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) {
public Observable<ServiceResponse<Page<SensitivityLabelInner>>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
Expand All @@ -312,7 +318,7 @@ public Observable<ServiceResponse<Page<SensitivityLabelInner>>> listByDatabaseSi
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), skipToken, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), includeDisabledRecommendations, skipToken, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SensitivityLabelInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SensitivityLabelInner>>> call(Response<ResponseBody> response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ public String informationTypeId() {
return this.inner().informationTypeId();
}

@Override
public Boolean isDisabled() {
return this.inner().isDisabled();
}

@Override
public String labelId() {
return this.inner().labelId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public class SensitivityLabelInner extends ProxyResource {
@JsonProperty(value = "properties.informationTypeId")
private String informationTypeId;

/**
* Is sensitivity recommendation disabled. Applicable for recommended
* sensitivity label only. Specifies whether the sensitivity recommendation
* on this column is disabled (dismissed) or not.
*/
@JsonProperty(value = "properties.isDisabled", access = JsonProperty.Access.WRITE_ONLY)
private Boolean isDisabled;

/**
* Get the label name.
*
Expand Down Expand Up @@ -121,4 +129,13 @@ public SensitivityLabelInner withInformationTypeId(String informationTypeId) {
return this;
}

/**
* Get is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not.
*
* @return the isDisabled value
*/
public Boolean isDisabled() {
return this.isDisabled;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ private SensitivityLabelImpl wrapModel(String name) {
return new SensitivityLabelImpl(name, this.manager());
}

@Override
public Completable enableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) {
SensitivityLabelsInner client = this.inner();
return client.enableRecommendationAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).toCompletable();
}

@Override
public Completable disableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) {
SensitivityLabelsInner client = this.inner();
return client.disableRecommendationAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).toCompletable();
}

@Override
public Observable<SensitivityLabel> getAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) {
SensitivityLabelsInner client = this.inner();
Expand Down
Loading