diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabel.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabel.java new file mode 100644 index 000000000000..3edcf9a484dd --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabel.java @@ -0,0 +1,55 @@ +/** + * 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.sql.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SensitivityLabelInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing DatabasisServerSensitivityLabel. + */ +public interface DatabasisServerSensitivityLabel extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the informationType value. + */ + String informationType(); + + /** + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * @return the labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabelModel.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabelModel.java new file mode 100644 index 000000000000..c0b983e85a9e --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabelModel.java @@ -0,0 +1,55 @@ +/** + * 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.sql.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SensitivityLabelInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing DatabasisServerSensitivityLabelModel. + */ +public interface DatabasisServerSensitivityLabelModel extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the informationType value. + */ + String informationType(); + + /** + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * @return the labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RecommendedSensitivityLabels.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RecommendedSensitivityLabels.java new file mode 100644 index 000000000000..8781026c7a22 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RecommendedSensitivityLabels.java @@ -0,0 +1,30 @@ +/** + * 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.sql.v2017_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.RecommendedSensitivityLabelsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RecommendedSensitivityLabels. + */ +public interface RecommendedSensitivityLabels extends HasInner { + /** + * Gets the sensitivity labels of a given database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabel.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabel.java new file mode 100644 index 000000000000..6d4c13aaf853 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabel.java @@ -0,0 +1,185 @@ +/** + * 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.sql.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SensitivityLabelInner; +import com.microsoft.azure.arm.model.Indexable; +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.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing SensitivityLabel. + */ +public interface SensitivityLabel extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the informationType value. + */ + String informationType(); + + /** + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * @return the labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SensitivityLabel definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithColumn, DefinitionStages.WithCreate { + } + + /** + * Grouping of SensitivityLabel definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SensitivityLabel definition. + */ + interface Blank extends WithColumn { + } + + /** + * The stage of the sensitivitylabel definition allowing to specify Column. + */ + interface WithColumn { + /** + * Specifies resourceGroupName, serverName, databaseName, schemaName, tableName, columnName. + */ + WithCreate withExistingColumn(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify InformationType. + */ + interface WithInformationType { + /** + * Specifies informationType. + */ + WithCreate withInformationType(String informationType); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify InformationTypeId. + */ + interface WithInformationTypeId { + /** + * Specifies informationTypeId. + */ + WithCreate withInformationTypeId(String informationTypeId); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify LabelId. + */ + interface WithLabelId { + /** + * Specifies labelId. + */ + WithCreate withLabelId(String labelId); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify LabelName. + */ + interface WithLabelName { + /** + * Specifies labelName. + */ + WithCreate withLabelName(String labelName); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithInformationType, DefinitionStages.WithInformationTypeId, DefinitionStages.WithLabelId, DefinitionStages.WithLabelName { + } + } + /** + * The template for a SensitivityLabel update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithInformationType, UpdateStages.WithInformationTypeId, UpdateStages.WithLabelId, UpdateStages.WithLabelName { + } + + /** + * Grouping of SensitivityLabel update stages. + */ + interface UpdateStages { + /** + * The stage of the sensitivitylabel update allowing to specify InformationType. + */ + interface WithInformationType { + /** + * Specifies informationType. + */ + Update withInformationType(String informationType); + } + + /** + * The stage of the sensitivitylabel update allowing to specify InformationTypeId. + */ + interface WithInformationTypeId { + /** + * Specifies informationTypeId. + */ + Update withInformationTypeId(String informationTypeId); + } + + /** + * The stage of the sensitivitylabel update allowing to specify LabelId. + */ + interface WithLabelId { + /** + * Specifies labelId. + */ + Update withLabelId(String labelId); + } + + /** + * The stage of the sensitivitylabel update allowing to specify LabelName. + */ + interface WithLabelName { + /** + * Specifies labelName. + */ + Update withLabelName(String labelName); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabelSource.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabelSource.java new file mode 100644 index 000000000000..436333e89dae --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabelSource.java @@ -0,0 +1,53 @@ +/** + * 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.sql.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SensitivityLabelSource. + */ +public enum SensitivityLabelSource { + /** Enum value current. */ + CURRENT("current"), + + /** Enum value recommended. */ + RECOMMENDED("recommended"); + + /** The actual serialized value for a SensitivityLabelSource instance. */ + private String value; + + SensitivityLabelSource(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SensitivityLabelSource instance. + * + * @param value the serialized value to parse. + * @return the parsed SensitivityLabelSource object, or null if unable to parse. + */ + @JsonCreator + public static SensitivityLabelSource fromString(String value) { + SensitivityLabelSource[] items = SensitivityLabelSource.values(); + for (SensitivityLabelSource item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabels.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabels.java new file mode 100644 index 000000000000..c264a024ff3f --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabels.java @@ -0,0 +1,62 @@ +/** + * 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.sql.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SensitivityLabelsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabel; + +/** + * Type representing SensitivityLabels. + */ +public interface SensitivityLabels extends SupportsCreating, HasInner { + /** + * Gets the sensitivity label of 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. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource); + + /** + * Deletes the sensitivity label of 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 deleteAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName); + + /** + * Gets the sensitivity labels of a given database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelImpl.java new file mode 100644 index 000000000000..bcbcdd452d1a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelImpl.java @@ -0,0 +1,65 @@ +/** + * 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.sql.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabel; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class DatabasisServerSensitivityLabelImpl extends WrapperImpl implements DatabasisServerSensitivityLabel { + private final SqlManager manager; + + DatabasisServerSensitivityLabelImpl(SensitivityLabelInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String informationType() { + return this.inner().informationType(); + } + + @Override + public String informationTypeId() { + return this.inner().informationTypeId(); + } + + @Override + public String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelModelImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelModelImpl.java new file mode 100644 index 000000000000..6de66ebdc06d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelModelImpl.java @@ -0,0 +1,65 @@ +/** + * 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.sql.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabelModel; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class DatabasisServerSensitivityLabelModelImpl extends WrapperImpl implements DatabasisServerSensitivityLabelModel { + private final SqlManager manager; + + DatabasisServerSensitivityLabelModelImpl(SensitivityLabelInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String informationType() { + return this.inner().informationType(); + } + + @Override + public String informationTypeId() { + return this.inner().informationTypeId(); + } + + @Override + public String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsImpl.java new file mode 100644 index 000000000000..8bbe2a989a9a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsImpl.java @@ -0,0 +1,53 @@ +/** + * 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.sql.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RecommendedSensitivityLabels; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabelModel; + +class RecommendedSensitivityLabelsImpl extends WrapperImpl implements RecommendedSensitivityLabels { + private final SqlManager manager; + + RecommendedSensitivityLabelsImpl(SqlManager manager) { + super(manager.inner().recommendedSensitivityLabels()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private DatabasisServerSensitivityLabelModelImpl wrapModel(SensitivityLabelInner inner) { + return new DatabasisServerSensitivityLabelModelImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + RecommendedSensitivityLabelsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DatabasisServerSensitivityLabelModel call(SensitivityLabelInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsInner.java new file mode 100644 index 000000000000..30c2ce8abd92 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsInner.java @@ -0,0 +1,447 @@ +/** + * 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.sql.v2017_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RecommendedSensitivityLabels. + */ +public class RecommendedSensitivityLabelsInner { + /** The Retrofit service to perform REST calls. */ + private RecommendedSensitivityLabelsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RecommendedSensitivityLabelsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecommendedSensitivityLabelsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RecommendedSensitivityLabelsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RecommendedSensitivityLabels to be + * used by Retrofit to perform actually REST calls. + */ + 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> 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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.RecommendedSensitivityLabels listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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. + * @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<SensitivityLabelInner> object if successful. + */ + public PagedList listByDatabase(final String resourceGroupName, final String serverName, final String databaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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 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> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 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()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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 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<SensitivityLabelInner> object if successful. + */ + public PagedList listByDatabase(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) { + ServiceResponse> response = listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, skipToken, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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 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> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, skipToken, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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 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<SensitivityLabelInner> object + */ + public Observable> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName, skipToken, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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 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<SensitivityLabelInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) { + return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, skipToken, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + ServiceResponse> * @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> * @param serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + ServiceResponse> * @param skipToken the String value + ServiceResponse> * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String skipToken, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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."); + } + return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), skipToken, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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<SensitivityLabelInner> object if successful. + */ + public PagedList listByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelImpl.java new file mode 100644 index 000000000000..0eba2e379943 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelImpl.java @@ -0,0 +1,148 @@ +/** + * 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.sql.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabel; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class SensitivityLabelImpl extends CreatableUpdatableImpl implements SensitivityLabel, SensitivityLabel.Definition, SensitivityLabel.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String schemaName; + private String tableName; + private String columnName; + + SensitivityLabelImpl(String name, SqlManager manager) { + super(name, new SensitivityLabelInner()); + this.manager = manager; + // Set resource name + this.columnName = name; + // + } + + SensitivityLabelImpl(SensitivityLabelInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.columnName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.schemaName = IdParsingUtils.getValueFromIdByName(inner.id(), "schemas"); + this.tableName = IdParsingUtils.getValueFromIdByName(inner.id(), "tables"); + this.columnName = IdParsingUtils.getValueFromIdByName(inner.id(), "columns"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SensitivityLabelsInner client = this.manager().inner().sensitivityLabels(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.schemaName, this.tableName, this.columnName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SensitivityLabelsInner client = this.manager().inner().sensitivityLabels(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.schemaName, this.tableName, this.columnName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SensitivityLabelsInner client = this.manager().inner().sensitivityLabels(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.schemaName, this.tableName, this.columnName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String informationType() { + return this.inner().informationType(); + } + + @Override + public String informationTypeId() { + return this.inner().informationTypeId(); + } + + @Override + public String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SensitivityLabelImpl withExistingColumn(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.schemaName = schemaName; + this.tableName = tableName; + this.columnName = columnName; + return this; + } + + @Override + public SensitivityLabelImpl withInformationType(String informationType) { + this.inner().withInformationType(informationType); + return this; + } + + @Override + public SensitivityLabelImpl withInformationTypeId(String informationTypeId) { + this.inner().withInformationTypeId(informationTypeId); + return this; + } + + @Override + public SensitivityLabelImpl withLabelId(String labelId) { + this.inner().withLabelId(labelId); + return this; + } + + @Override + public SensitivityLabelImpl withLabelName(String labelName) { + this.inner().withLabelName(labelName); + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelInner.java new file mode 100644 index 000000000000..a283349393eb --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelInner.java @@ -0,0 +1,124 @@ +/** + * 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.sql.v2017_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A sensitivity label. + */ +@JsonFlatten +public class SensitivityLabelInner extends ProxyResource { + /** + * The label name. + */ + @JsonProperty(value = "properties.labelName") + private String labelName; + + /** + * The label ID. + */ + @JsonProperty(value = "properties.labelId") + private String labelId; + + /** + * The information type. + */ + @JsonProperty(value = "properties.informationType") + private String informationType; + + /** + * The information type ID. + */ + @JsonProperty(value = "properties.informationTypeId") + private String informationTypeId; + + /** + * Get the label name. + * + * @return the labelName value + */ + public String labelName() { + return this.labelName; + } + + /** + * Set the label name. + * + * @param labelName the labelName value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withLabelName(String labelName) { + this.labelName = labelName; + return this; + } + + /** + * Get the label ID. + * + * @return the labelId value + */ + public String labelId() { + return this.labelId; + } + + /** + * Set the label ID. + * + * @param labelId the labelId value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withLabelId(String labelId) { + this.labelId = labelId; + return this; + } + + /** + * Get the information type. + * + * @return the informationType value + */ + public String informationType() { + return this.informationType; + } + + /** + * Set the information type. + * + * @param informationType the informationType value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withInformationType(String informationType) { + this.informationType = informationType; + return this; + } + + /** + * Get the information type ID. + * + * @return the informationTypeId value + */ + public String informationTypeId() { + return this.informationTypeId; + } + + /** + * Set the information type ID. + * + * @param informationTypeId the informationTypeId value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withInformationTypeId(String informationTypeId) { + this.informationTypeId = informationTypeId; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsImpl.java new file mode 100644 index 000000000000..31534a7af455 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsImpl.java @@ -0,0 +1,86 @@ +/** + * 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.sql.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabels; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabel; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabel; + +class SensitivityLabelsImpl extends WrapperImpl implements SensitivityLabels { + private final SqlManager manager; + + SensitivityLabelsImpl(SqlManager manager) { + super(manager.inner().sensitivityLabels()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public SensitivityLabelImpl define(String name) { + return wrapModel(name); + } + + private SensitivityLabelImpl wrapModel(SensitivityLabelInner inner) { + return new SensitivityLabelImpl(inner, manager()); + } + + private SensitivityLabelImpl wrapModel(String name) { + return new SensitivityLabelImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + SensitivityLabelsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource) + .map(new Func1() { + @Override + public SensitivityLabel call(SensitivityLabelInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + SensitivityLabelsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).toCompletable(); + } + + private DatabasisServerSensitivityLabelImpl wrapDatabasisServerSensitivityLabelModel(SensitivityLabelInner inner) { + return new DatabasisServerSensitivityLabelImpl(inner, manager()); + } + + @Override + public Observable listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + SensitivityLabelsInner client = this.inner(); + return client.listCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DatabasisServerSensitivityLabel call(SensitivityLabelInner inner) { + return wrapDatabasisServerSensitivityLabelModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsInner.java new file mode 100644 index 000000000000..29f800ff8fea --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsInner.java @@ -0,0 +1,818 @@ +/** + * 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.sql.v2017_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabelSource; +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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in SensitivityLabels. + */ +public class SensitivityLabelsInner { + /** The Retrofit service to perform REST calls. */ + private SensitivityLabelsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of SensitivityLabelsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SensitivityLabelsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(SensitivityLabelsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SensitivityLabels to be + * used by Retrofit to perform actually REST calls. + */ + interface SensitivityLabelsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabels listCurrentByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels") + Observable> listCurrentByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @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.SensitivityLabels get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") SensitivityLabelSource sensitivityLabelSource, @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_03_01_preview.SensitivityLabels createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") String sensitivityLabelSource, @Path("subscriptionId") String subscriptionId, @Body SensitivityLabelInner parameters, @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.SensitivityLabels delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") String sensitivityLabelSource, @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_03_01_preview.SensitivityLabels listCurrentByDatabaseNext" }) + @GET + Observable> listCurrentByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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. + * @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<SensitivityLabelInner> object if successful. + */ + public PagedList listCurrentByDatabase(final String resourceGroupName, final String serverName, final String databaseName) { + ServiceResponse> response = listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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 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> listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listCurrentByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listCurrentByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listCurrentByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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 filter = null; + return service.listCurrentByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCurrentByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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 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<SensitivityLabelInner> object if successful. + */ + public PagedList listCurrentByDatabase(final String resourceGroupName, final String serverName, final String databaseName, final String filter) { + ServiceResponse> response = listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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 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> listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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 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<SensitivityLabelInner> object + */ + public Observable> listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String filter) { + return listCurrentByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @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 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<SensitivityLabelInner> object + */ + public Observable>> listCurrentByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String filter) { + return listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + ServiceResponse> * @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> * @param serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + ServiceResponse> * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listCurrentByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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."); + } + return service.listCurrentByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCurrentByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listCurrentByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the sensitivity label of 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. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @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 SensitivityLabelInner object if successful. + */ + public SensitivityLabelInner get(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource).toBlocking().single().body(); + } + + /** + * Gets the sensitivity label of 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. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @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 getAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource), serviceCallback); + } + + /** + * Gets the sensitivity label of 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. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource).map(new Func1, SensitivityLabelInner>() { + @Override + public SensitivityLabelInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity label of 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. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName is required and cannot be null."); + } + if (sensitivityLabelSource == null) { + throw new IllegalArgumentException("Parameter sensitivityLabelSource 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."); + } + return service.get(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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); + } + + /** + * Creates or updates the sensitivity label of 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. + * @param parameters The column sensitivity label resource. + * @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 SensitivityLabelInner object if successful. + */ + public SensitivityLabelInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the sensitivity label of 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. + * @param parameters The column sensitivity label resource. + * @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 createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters), serviceCallback); + } + + /** + * Creates or updates the sensitivity label of 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. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters).map(new Func1, SensitivityLabelInner>() { + @Override + public SensitivityLabelInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the sensitivity label of 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. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters 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(parameters); + final String sensitivityLabelSource = "current"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, this.client.subscriptionId(), parameters, this.client.apiVersion(), 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); + } + + /** + * Deletes the sensitivity label of 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 + * @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 delete(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).toBlocking().single().body(); + } + + /** + * Deletes the sensitivity label of 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. + * @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 deleteAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName), serviceCallback); + } + + /** + * Deletes the sensitivity label of 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 {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the sensitivity label of 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 {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "current"; + return service.delete(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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<SensitivityLabelInner> object if successful. + */ + public PagedList listCurrentByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listCurrentByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listCurrentByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listCurrentByDatabaseNextAsync(final String nextPageLink) { + return listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listCurrentByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listCurrentByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listCurrentByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCurrentByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listCurrentByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java index 3e441c6be62c..762bdaeaf67a 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java @@ -522,6 +522,32 @@ public ManagedServerSecurityAlertPoliciesInner managedServerSecurityAlertPolicie return this.managedServerSecurityAlertPolicies; } + /** + * The SensitivityLabelsInner object to access its operations. + */ + private SensitivityLabelsInner sensitivityLabels; + + /** + * Gets the SensitivityLabelsInner object to access its operations. + * @return the SensitivityLabelsInner object. + */ + public SensitivityLabelsInner sensitivityLabels() { + return this.sensitivityLabels; + } + + /** + * The RecommendedSensitivityLabelsInner object to access its operations. + */ + private RecommendedSensitivityLabelsInner recommendedSensitivityLabels; + + /** + * Gets the RecommendedSensitivityLabelsInner object to access its operations. + * @return the RecommendedSensitivityLabelsInner object. + */ + public RecommendedSensitivityLabelsInner recommendedSensitivityLabels() { + return this.recommendedSensitivityLabels; + } + /** * Initializes an instance of SqlManagementClient client. * @@ -587,6 +613,8 @@ protected void initialize() { this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesInner(restClient().retrofit(), this); this.managedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesInner(restClient().retrofit(), this); this.managedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.sensitivityLabels = new SensitivityLabelsInner(restClient().retrofit(), this); + this.recommendedSensitivityLabels = new RecommendedSensitivityLabelsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java index d14cd0893ed9..1986ddeb98fe 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java @@ -46,6 +46,8 @@ import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicies; import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies; import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabels; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RecommendedSensitivityLabels; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -83,6 +85,8 @@ public final class SqlManager extends ManagerCore