diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicies.java new file mode 100644 index 0000000000000..b630ce2290b74 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedDatabaseSecurityAlertPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedDatabaseSecurityAlertPolicies. + */ +public interface ManagedDatabaseSecurityAlertPolicies extends SupportsCreating, HasInner { + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicy.java new file mode 100644 index 0000000000000..a1118f57bae57 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicy.java @@ -0,0 +1,257 @@ +/** + * 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.ManagedDatabaseSecurityAlertPolicyInner; +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; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing ManagedDatabaseSecurityAlertPolicy. + */ +public interface ManagedDatabaseSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationTime value. + */ + DateTime creationTime(); + + /** + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + SecurityAlertPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ManagedDatabaseSecurityAlertPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedDatabaseSecurityAlertPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedDatabaseSecurityAlertPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + */ + WithState withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + + /** + * 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.WithDisabledAlerts, DefinitionStages.WithEmailAccountAdmins, DefinitionStages.WithEmailAddresses, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a ManagedDatabaseSecurityAlertPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDisabledAlerts, UpdateStages.WithEmailAccountAdmins, UpdateStages.WithEmailAddresses, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of ManagedDatabaseSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + Update withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + Update withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicies.java new file mode 100644 index 0000000000000..0132f1a4cf722 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicies.java @@ -0,0 +1,34 @@ +/** + * 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; + +/** + * Type representing ManagedServerSecurityAlertPolicies. + */ +public interface ManagedServerSecurityAlertPolicies { + /** + * Begins definition for a new SecurityAlertPolicy resource. + * @param name resource name. + * @return the first stage of the new SecurityAlertPolicy definition. + */ + ManagedServerSecurityAlertPolicy.DefinitionStages.Blank defineSecurityAlertPolicy(String name); + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicy.java new file mode 100644 index 0000000000000..45e719449b3fd --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicy.java @@ -0,0 +1,257 @@ +/** + * 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.ManagedServerSecurityAlertPolicyInner; +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; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing ManagedServerSecurityAlertPolicy. + */ +public interface ManagedServerSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationTime value. + */ + DateTime creationTime(); + + /** + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + SecurityAlertPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ManagedServerSecurityAlertPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagedInstance, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedServerSecurityAlertPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedServerSecurityAlertPolicy definition. + */ + interface Blank extends WithManagedInstance { + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify ManagedInstance. + */ + interface WithManagedInstance { + /** + * Specifies resourceGroupName, managedInstanceName. + */ + WithState withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + + /** + * 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.WithDisabledAlerts, DefinitionStages.WithEmailAccountAdmins, DefinitionStages.WithEmailAddresses, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a ManagedServerSecurityAlertPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDisabledAlerts, UpdateStages.WithEmailAccountAdmins, UpdateStages.WithEmailAddresses, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of ManagedServerSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + Update withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + Update withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java index 186e024a92108..4cb5c7f300120 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java @@ -18,11 +18,17 @@ import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; import java.util.List; +import org.joda.time.DateTime; /** * Type representing ServerSecurityAlertPolicy. */ public interface ServerSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationTime value. + */ + DateTime creationTime(); + /** * @return the disabledAlerts value. */ diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..1de57a3805c5c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.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.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicy; + +class ManagedDatabaseSecurityAlertPoliciesImpl extends WrapperImpl implements ManagedDatabaseSecurityAlertPolicies { + private final SqlManager manager; + + ManagedDatabaseSecurityAlertPoliciesImpl(SqlManager manager) { + super(manager.inner().managedDatabaseSecurityAlertPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl define(String name) { + return wrapModel(name); + } + + private ManagedDatabaseSecurityAlertPolicyImpl wrapModel(ManagedDatabaseSecurityAlertPolicyInner inner) { + return new ManagedDatabaseSecurityAlertPolicyImpl(inner, manager()); + } + + private ManagedDatabaseSecurityAlertPolicyImpl wrapModel(String name) { + return new ManagedDatabaseSecurityAlertPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1() { + @Override + public ManagedDatabaseSecurityAlertPolicy call(ManagedDatabaseSecurityAlertPolicyInner 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/ManagedDatabaseSecurityAlertPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesInner.java new file mode 100644 index 0000000000000..84c2a07d63306 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesInner.java @@ -0,0 +1,264 @@ +/** + * 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.CloudException; +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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedDatabaseSecurityAlertPolicies. + */ +public class ManagedDatabaseSecurityAlertPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseSecurityAlertPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSecurityAlertPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseSecurityAlertPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseSecurityAlertPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseSecurityAlertPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseSecurityAlertPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @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.ManagedDatabaseSecurityAlertPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @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 ManagedDatabaseSecurityAlertPolicyInner object if successful. + */ + public ManagedDatabaseSecurityAlertPolicyInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @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 managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseSecurityAlertPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedDatabaseSecurityAlertPolicyInner>() { + @Override + public ManagedDatabaseSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseSecurityAlertPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (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 securityAlertPolicyName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, 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 a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @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 ManagedDatabaseSecurityAlertPolicyInner object if successful. + */ + public ManagedDatabaseSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @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 managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseSecurityAlertPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseSecurityAlertPolicyInner>() { + @Override + public ManagedDatabaseSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseSecurityAlertPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (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 (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 securityAlertPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..28ea47bef2cba --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java @@ -0,0 +1,180 @@ +/** + * 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.ManagedDatabaseSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; + +class ManagedDatabaseSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements ManagedDatabaseSecurityAlertPolicy, ManagedDatabaseSecurityAlertPolicy.Definition, ManagedDatabaseSecurityAlertPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + ManagedDatabaseSecurityAlertPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedDatabaseSecurityAlertPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + ManagedDatabaseSecurityAlertPolicyImpl(ManagedDatabaseSecurityAlertPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedDatabaseSecurityAlertPoliciesInner client = this.manager().inner().managedDatabaseSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedDatabaseSecurityAlertPoliciesInner client = this.manager().inner().managedDatabaseSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseSecurityAlertPoliciesInner client = this.manager().inner().managedDatabaseSecurityAlertPolicies(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime creationTime() { + return this.inner().creationTime(); + } + + @Override + public List disabledAlerts() { + return this.inner().disabledAlerts(); + } + + @Override + public Boolean emailAccountAdmins() { + return this.inner().emailAccountAdmins(); + } + + @Override + public List emailAddresses() { + return this.inner().emailAddresses(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public SecurityAlertPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + 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/ManagedDatabaseSecurityAlertPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..40a8bf5e3075d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyInner.java @@ -0,0 +1,226 @@ +/** + * 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.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A managed database security alert policy. + */ +@JsonFlatten +public class ManagedDatabaseSecurityAlertPolicyInner extends ProxyResource { + /** + * Specifies the state of the policy, whether it is enabled or disabled. + * Possible values include: 'New', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private SecurityAlertPolicyState state; + + /** + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, + * Data_Exfiltration, Unsafe_Action. + */ + @JsonProperty(value = "properties.disabledAlerts") + private List disabledAlerts; + + /** + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private List emailAddresses; + + /** + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private Boolean emailAccountAdmins; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationTime; + + /** + * Get specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @return the state value + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withState(SecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @return the disabledAlerts value + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts the disabledAlerts value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the Threat Detection audit storage account. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the Threat Detection audit storage account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the UTC creation time of the policy. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..3eee0e8fa9724 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesImpl.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. + * abc + */ + +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.ManagedServerSecurityAlertPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicy; + +class ManagedServerSecurityAlertPoliciesImpl extends WrapperImpl implements ManagedServerSecurityAlertPolicies { + private final SqlManager manager; + + ManagedServerSecurityAlertPoliciesImpl(SqlManager manager) { + super(manager.inner().managedServerSecurityAlertPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl defineSecurityAlertPolicy(String name) { + return wrapSecurityAlertPolicyModel(name); + } + + private ManagedServerSecurityAlertPolicyImpl wrapSecurityAlertPolicyModel(String name) { + return new ManagedServerSecurityAlertPolicyImpl(name, this.manager()); + } + + private ManagedServerSecurityAlertPolicyImpl wrapManagedServerSecurityAlertPolicyModel(ManagedServerSecurityAlertPolicyInner inner) { + return new ManagedServerSecurityAlertPolicyImpl(inner, manager()); + } + + private Observable getManagedServerSecurityAlertPolicyInnerUsingManagedServerSecurityAlertPoliciesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + ManagedServerSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + ManagedServerSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName) + .map(new Func1() { + @Override + public ManagedServerSecurityAlertPolicy call(ManagedServerSecurityAlertPolicyInner inner) { + return wrapManagedServerSecurityAlertPolicyModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesInner.java new file mode 100644 index 0000000000000..04fcb94bf3f77 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesInner.java @@ -0,0 +1,332 @@ +/** + * 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.CloudException; +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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedServerSecurityAlertPolicies. + */ +public class ManagedServerSecurityAlertPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedServerSecurityAlertPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedServerSecurityAlertPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedServerSecurityAlertPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedServerSecurityAlertPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServerSecurityAlertPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedServerSecurityAlertPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @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.ManagedServerSecurityAlertPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ManagedServerSecurityAlertPolicyInner 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.ManagedServerSecurityAlertPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ManagedServerSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedServerSecurityAlertPolicyInner object if successful. + */ + public ManagedServerSecurityAlertPolicyInner get(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, ManagedServerSecurityAlertPolicyInner>() { + @Override + public ManagedServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a managed server's threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String securityAlertPolicyName = "Default"; + return service.get(resourceGroupName, managedInstanceName, securityAlertPolicyName, 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 a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The managed server security alert policy. + * @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 ManagedServerSecurityAlertPolicyInner object if successful. + */ + public ManagedServerSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The managed server security alert policy. + * @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 managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedServerSecurityAlertPolicyInner>() { + @Override + public ManagedServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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 securityAlertPolicyName = "Default"; + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, securityAlertPolicyName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The managed server security alert policy. + * @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 ManagedServerSecurityAlertPolicyInner object if successful. + */ + public ManagedServerSecurityAlertPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The managed server security alert policy. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedServerSecurityAlertPolicyInner>() { + @Override + public ManagedServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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 securityAlertPolicyName = "Default"; + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, securityAlertPolicyName, 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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, 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/ManagedServerSecurityAlertPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..64d7bec674bae --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyImpl.java @@ -0,0 +1,177 @@ +/** + * 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.ManagedServerSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; + +class ManagedServerSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements ManagedServerSecurityAlertPolicy, ManagedServerSecurityAlertPolicy.Definition, ManagedServerSecurityAlertPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + + ManagedServerSecurityAlertPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedServerSecurityAlertPolicyInner()); + this.manager = manager; + // Set resource name + this.managedInstanceName = name; + // + } + + ManagedServerSecurityAlertPolicyImpl(ManagedServerSecurityAlertPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.managedInstanceName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedServerSecurityAlertPoliciesInner client = this.manager().inner().managedServerSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedServerSecurityAlertPoliciesInner client = this.manager().inner().managedServerSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedServerSecurityAlertPoliciesInner client = this.manager().inner().managedServerSecurityAlertPolicies(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime creationTime() { + return this.inner().creationTime(); + } + + @Override + public List disabledAlerts() { + return this.inner().disabledAlerts(); + } + + @Override + public Boolean emailAccountAdmins() { + return this.inner().emailAccountAdmins(); + } + + @Override + public List emailAddresses() { + return this.inner().emailAddresses(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public SecurityAlertPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + 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/ManagedServerSecurityAlertPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..66562b4b989a0 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyInner.java @@ -0,0 +1,226 @@ +/** + * 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.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A managed server security alert policy. + */ +@JsonFlatten +public class ManagedServerSecurityAlertPolicyInner extends ProxyResource { + /** + * Specifies the state of the policy, whether it is enabled or disabled. + * Possible values include: 'New', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private SecurityAlertPolicyState state; + + /** + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, + * Data_Exfiltration, Unsafe_Action. + */ + @JsonProperty(value = "properties.disabledAlerts") + private List disabledAlerts; + + /** + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private List emailAddresses; + + /** + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private Boolean emailAccountAdmins; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationTime; + + /** + * Get specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @return the state value + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withState(SecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @return the disabledAlerts value + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts the disabledAlerts value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the Threat Detection audit storage account. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the Threat Detection audit storage account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the UTC creation time of the policy. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java index ffda6000b3e85..b8776a73fe87c 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java @@ -13,6 +13,7 @@ import rx.Observable; import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; import java.util.List; +import org.joda.time.DateTime; class ServerSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements ServerSecurityAlertPolicy, ServerSecurityAlertPolicy.Definition, ServerSecurityAlertPolicy.Update { private final SqlManager manager; @@ -69,6 +70,11 @@ public boolean isInCreateMode() { } + @Override + public DateTime creationTime() { + return this.inner().creationTime(); + } + @Override public List disabledAlerts() { return this.inner().disabledAlerts(); diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java index 2441ffcb32c1c..378b5739a87a0 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java @@ -10,6 +10,7 @@ import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; import java.util.List; +import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.ProxyResource; @@ -67,6 +68,12 @@ public class ServerSecurityAlertPolicyInner extends ProxyResource { @JsonProperty(value = "properties.retentionDays") private Integer retentionDays; + /** + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationTime; + /** * Get specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled'. * @@ -207,4 +214,13 @@ public ServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { return this; } + /** + * Get specifies the UTC creation time of the policy. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + } 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 8805ab4bf344d..f0fdd0ef1571d 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 @@ -470,6 +470,32 @@ public ServerSecurityAlertPoliciesInner serverSecurityAlertPolicies() { return this.serverSecurityAlertPolicies; } + /** + * The ManagedDatabaseSecurityAlertPoliciesInner object to access its operations. + */ + private ManagedDatabaseSecurityAlertPoliciesInner managedDatabaseSecurityAlertPolicies; + + /** + * Gets the ManagedDatabaseSecurityAlertPoliciesInner object to access its operations. + * @return the ManagedDatabaseSecurityAlertPoliciesInner object. + */ + public ManagedDatabaseSecurityAlertPoliciesInner managedDatabaseSecurityAlertPolicies() { + return this.managedDatabaseSecurityAlertPolicies; + } + + /** + * The ManagedServerSecurityAlertPoliciesInner object to access its operations. + */ + private ManagedServerSecurityAlertPoliciesInner managedServerSecurityAlertPolicies; + + /** + * Gets the ManagedServerSecurityAlertPoliciesInner object to access its operations. + * @return the ManagedServerSecurityAlertPoliciesInner object. + */ + public ManagedServerSecurityAlertPoliciesInner managedServerSecurityAlertPolicies() { + return this.managedServerSecurityAlertPolicies; + } + /** * Initializes an instance of SqlManagementClient client. * @@ -531,6 +557,8 @@ protected void initialize() { this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.managedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.managedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesInner(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 17ec28e13069e..0a09877ffea8e 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 @@ -42,6 +42,8 @@ import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerAutomaticTunings; import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerDnsAliases; 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.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -75,6 +77,8 @@ public final class SqlManager extends ManagerCore