From b99f2008136e68e6a5103c62c7a28369f13a0066 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 2 Oct 2018 13:15:08 +0000 Subject: [PATCH] Generated from 1d3074c3f3f50b396875f414d62eec4195234f83 Update readme.md --- .../DatabaseVulnerabilityAssessment.java | 189 +++-- ...seVulnerabilityAssessmentRuleBaseline.java | 111 +++ ...lnerabilityAssessmentRuleBaselineItem.java | 45 ++ .../DatabaseVulnerabilityAssessmentScans.java | 6 +- ...eVulnerabilityAssessmentRuleBaselines.java | 51 ++ ...dDatabaseVulnerabilityAssessmentScans.java | 67 ++ ...nagedDatabaseVulnerabilityAssessments.java | 47 ++ ...anceVulnerabilityAssessmentScanRecord.java | 79 ++ ...rverVulnerabilityAssessmentScanRecord.java | 79 ++ ...erabilityAssessmentPolicyBaselineName.java | 53 ++ .../DatabaseVulnerabilityAssessmentImpl.java | 140 ++++ .../DatabaseVulnerabilityAssessmentInner.java | 131 ++++ ...lnerabilityAssessmentRuleBaselineImpl.java | 120 +++ ...nerabilityAssessmentRuleBaselineInner.java | 48 ++ ...abaseVulnerabilityAssessmentScansImpl.java | 22 +- ...nerabilityAssessmentRuleBaselinesImpl.java | 72 ++ ...erabilityAssessmentRuleBaselinesInner.java | 408 ++++++++++ ...abaseVulnerabilityAssessmentScansImpl.java | 85 +++ ...baseVulnerabilityAssessmentScansInner.java | 717 ++++++++++++++++++ ...dDatabaseVulnerabilityAssessmentsImpl.java | 70 ++ ...DatabaseVulnerabilityAssessmentsInner.java | 362 +++++++++ ...VulnerabilityAssessmentScanRecordImpl.java | 104 +++ ...VulnerabilityAssessmentScanRecordImpl.java | 104 +++ .../SqlManagementClientImpl.java | 42 + .../implementation/SqlManager.java | 36 + 25 files changed, 3117 insertions(+), 71 deletions(-) create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentScans.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVulnerabilityAssessmentScanRecord.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVulnerabilityAssessmentScanRecord.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentPolicyBaselineName.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java create mode 100644 sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java index b363f4918cf43..82e299cd0b656 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java @@ -8,93 +8,168 @@ package com.microsoft.azure.management.sql.v2017_10_01_preview; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.microsoft.rest.serializer.JsonFlatten; -import com.microsoft.azure.ProxyResource; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseVulnerabilityAssessmentInner; +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_10_01_preview.implementation.SqlManager; /** - * A database vulnerability assessment. + * Type representing DatabaseVulnerabilityAssessment. */ -@JsonFlatten -public class DatabaseVulnerabilityAssessment extends ProxyResource { +public interface DatabaseVulnerabilityAssessment extends HasInner, Indexable, Refreshable, Updatable, HasManager { /** - * A blob storage container path to hold the scan results (e.g. - * https://myStorage.blob.core.windows.net/VaScans/). + * @return the id value. */ - @JsonProperty(value = "properties.storageContainerPath", required = true) - private String storageContainerPath; + String id(); /** - * A shared access signature (SAS Key) that has write access to the blob - * container specified in 'storageContainerPath' parameter. + * @return the name value. */ - @JsonProperty(value = "properties.storageContainerSasKey", required = true) - private String storageContainerSasKey; + String name(); /** - * The recurring scans settings. + * @return the recurringScans value. */ - @JsonProperty(value = "properties.recurringScans") - private VulnerabilityAssessmentRecurringScansProperties recurringScans; + VulnerabilityAssessmentRecurringScansProperties recurringScans(); /** - * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - * - * @return the storageContainerPath value + * @return the storageAccountAccessKey value. */ - public String storageContainerPath() { - return this.storageContainerPath; - } + String storageAccountAccessKey(); /** - * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - * - * @param storageContainerPath the storageContainerPath value to set - * @return the DatabaseVulnerabilityAssessment object itself. + * @return the storageContainerPath value. */ - public DatabaseVulnerabilityAssessment withStorageContainerPath(String storageContainerPath) { - this.storageContainerPath = storageContainerPath; - return this; - } + String storageContainerPath(); /** - * Get a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. - * - * @return the storageContainerSasKey value + * @return the storageContainerSasKey value. */ - public String storageContainerSasKey() { - return this.storageContainerSasKey; - } + String storageContainerSasKey(); /** - * Set a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. - * - * @param storageContainerSasKey the storageContainerSasKey value to set - * @return the DatabaseVulnerabilityAssessment object itself. + * @return the type value. */ - public DatabaseVulnerabilityAssessment withStorageContainerSasKey(String storageContainerSasKey) { - this.storageContainerSasKey = storageContainerSasKey; - return this; - } + String type(); /** - * Get the recurring scans settings. - * - * @return the recurringScans value + * The entirety of the DatabaseVulnerabilityAssessment definition. */ - public VulnerabilityAssessmentRecurringScansProperties recurringScans() { - return this.recurringScans; + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithStorageContainerPath, DefinitionStages.WithCreate { } /** - * Set the recurring scans settings. - * - * @param recurringScans the recurringScans value to set - * @return the DatabaseVulnerabilityAssessment object itself. + * Grouping of DatabaseVulnerabilityAssessment definition stages. */ - public DatabaseVulnerabilityAssessment withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { - this.recurringScans = recurringScans; - return this; + interface DefinitionStages { + /** + * The first stage of a DatabaseVulnerabilityAssessment definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + */ + WithStorageContainerPath withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies storageContainerPath. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasevulnerabilityassessment definition allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + + /** + * 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.WithRecurringScans, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageContainerSasKey { + } + } + /** + * The template for a DatabaseVulnerabilityAssessment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRecurringScans, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageContainerSasKey { } + /** + * Grouping of DatabaseVulnerabilityAssessment update stages. + */ + interface UpdateStages { + /** + * The stage of the databasevulnerabilityassessment update allowing to specify RecurringScans. + */ + interface WithRecurringScans { + /** + * Specifies recurringScans. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasevulnerabilityassessment update allowing to specify StorageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies storageContainerSasKey. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + + } } diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.java new file mode 100644 index 0000000000000..3867a173423f1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaseline.java @@ -0,0 +1,111 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseVulnerabilityAssessmentRuleBaselineInner; +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_10_01_preview.implementation.SqlManager; +import java.util.List; + +/** + * Type representing DatabaseVulnerabilityAssessmentRuleBaseline. + */ +public interface DatabaseVulnerabilityAssessmentRuleBaseline extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the baselineResults value. + */ + List baselineResults(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRule, DefinitionStages.WithBaselineResults, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseVulnerabilityAssessmentRuleBaseline definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + interface Blank extends WithRule { + } + + /** + * The stage of the databasevulnerabilityassessmentrulebaseline definition allowing to specify Rule. + */ + interface WithRule { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName, ruleId. + */ + WithBaselineResults withExistingRule(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId); + } + + /** + * The stage of the databasevulnerabilityassessmentrulebaseline definition allowing to specify BaselineResults. + */ + interface WithBaselineResults { + /** + * Specifies baselineResults. + */ + WithCreate withBaselineResults(List baselineResults); + } + + /** + * 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 { + } + } + /** + * The template for a DatabaseVulnerabilityAssessmentRuleBaseline update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithBaselineResults { + } + + /** + * Grouping of DatabaseVulnerabilityAssessmentRuleBaseline update stages. + */ + interface UpdateStages { + /** + * The stage of the databasevulnerabilityassessmentrulebaseline update allowing to specify BaselineResults. + */ + interface WithBaselineResults { + /** + * Specifies baselineResults. + */ + Update withBaselineResults(List baselineResults); + } + + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java new file mode 100644 index 0000000000000..8af515f3ab257 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentRuleBaselineItem.java @@ -0,0 +1,45 @@ +/** + * 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_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for an Azure SQL Database Vulnerability Assessment rule + * baseline's result. + */ +public class DatabaseVulnerabilityAssessmentRuleBaselineItem { + /** + * The rule baseline result. + */ + @JsonProperty(value = "result", required = true) + private List result; + + /** + * Get the rule baseline result. + * + * @return the result value + */ + public List result() { + return this.result; + } + + /** + * Set the rule baseline result. + * + * @param result the result value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineItem object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineItem withResult(List result) { + this.result = result; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java index b57f178bb0dcb..b06b176e94e2e 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java @@ -9,7 +9,7 @@ package com.microsoft.azure.management.sql.v2017_10_01_preview; import rx.Observable; -import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanRecord; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerVulnerabilityAssessmentScanRecord; import rx.Completable; /** @@ -26,7 +26,7 @@ public interface DatabaseVulnerabilityAssessmentScans { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId); + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId); /** * Lists the vulnerability assessment scans of a database. @@ -37,7 +37,7 @@ public interface DatabaseVulnerabilityAssessmentScans { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName); + Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName); /** * Executes a Vulnerability Assessment database scan. diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java new file mode 100644 index 0000000000000..e2ea17009a99b --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java @@ -0,0 +1,51 @@ +/** + * 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_10_01_preview; + +import rx.Observable; +import rx.Completable; + +/** + * Type representing ManagedDatabaseVulnerabilityAssessmentRuleBaselines. + */ +public interface ManagedDatabaseVulnerabilityAssessmentRuleBaselines { + /** + * Begins definition for a new Baseline resource. + * @param name resource name. + * @return the first stage of the new Baseline definition. + */ + DatabaseVulnerabilityAssessmentRuleBaseline.DefinitionStages.Blank defineBaseline(String name); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentScans.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..84eb0df1f5428 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessmentScans.java @@ -0,0 +1,67 @@ +/** + * 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_10_01_preview; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedDatabaseVulnerabilityAssessmentScansInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedDatabaseVulnerabilityAssessmentScans. + */ +public interface ManagedDatabaseVulnerabilityAssessmentScans extends HasInner { + /** + * Executes a Vulnerability Assessment database scan. + * + * @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 database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId); + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId); + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.java new file mode 100644 index 0000000000000..a968416a939b3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedDatabaseVulnerabilityAssessments.java @@ -0,0 +1,47 @@ +/** + * 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_10_01_preview; + +import rx.Observable; +import rx.Completable; + +/** + * Type representing ManagedDatabaseVulnerabilityAssessments. + */ +public interface ManagedDatabaseVulnerabilityAssessments { + /** + * Begins definition for a new VulnerabilityAssessment resource. + * @param name resource name. + * @return the first stage of the new VulnerabilityAssessment definition. + */ + DatabaseVulnerabilityAssessment.DefinitionStages.Blank defineVulnerabilityAssessment(String name); + + /** + * Gets the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Removes the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVulnerabilityAssessmentScanRecord.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVulnerabilityAssessmentScanRecord.java new file mode 100644 index 0000000000000..c47199200be6e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVulnerabilityAssessmentScanRecord.java @@ -0,0 +1,79 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.VulnerabilityAssessmentScanRecordInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ManagedInstanceVulnerabilityAssessmentScanRecord. + */ +public interface ManagedInstanceVulnerabilityAssessmentScanRecord extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errors value. + */ + List errors(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the numberOfFailedSecurityChecks value. + */ + Integer numberOfFailedSecurityChecks(); + + /** + * @return the scanId value. + */ + String scanId(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + VulnerabilityAssessmentScanState state(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the triggerType value. + */ + VulnerabilityAssessmentScanTriggerType triggerType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVulnerabilityAssessmentScanRecord.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVulnerabilityAssessmentScanRecord.java new file mode 100644 index 0000000000000..40d70282c88d5 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVulnerabilityAssessmentScanRecord.java @@ -0,0 +1,79 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.VulnerabilityAssessmentScanRecordInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ServerVulnerabilityAssessmentScanRecord. + */ +public interface ServerVulnerabilityAssessmentScanRecord extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errors value. + */ + List errors(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the numberOfFailedSecurityChecks value. + */ + Integer numberOfFailedSecurityChecks(); + + /** + * @return the scanId value. + */ + String scanId(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + VulnerabilityAssessmentScanState state(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the triggerType value. + */ + VulnerabilityAssessmentScanTriggerType triggerType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentPolicyBaselineName.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentPolicyBaselineName.java new file mode 100644 index 0000000000000..8eb67b02d36a3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentPolicyBaselineName.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for VulnerabilityAssessmentPolicyBaselineName. + */ +public enum VulnerabilityAssessmentPolicyBaselineName { + /** Enum value master. */ + MASTER("master"), + + /** Enum value default. */ + DEFAULT("default"); + + /** The actual serialized value for a VulnerabilityAssessmentPolicyBaselineName instance. */ + private String value; + + VulnerabilityAssessmentPolicyBaselineName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a VulnerabilityAssessmentPolicyBaselineName instance. + * + * @param value the serialized value to parse. + * @return the parsed VulnerabilityAssessmentPolicyBaselineName object, or null if unable to parse. + */ + @JsonCreator + public static VulnerabilityAssessmentPolicyBaselineName fromString(String value) { + VulnerabilityAssessmentPolicyBaselineName[] items = VulnerabilityAssessmentPolicyBaselineName.values(); + for (VulnerabilityAssessmentPolicyBaselineName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..809982bc6711a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentImpl.java @@ -0,0 +1,140 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentRecurringScansProperties; + +class DatabaseVulnerabilityAssessmentImpl extends CreatableUpdatableImpl implements DatabaseVulnerabilityAssessment, DatabaseVulnerabilityAssessment.Definition, DatabaseVulnerabilityAssessment.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + DatabaseVulnerabilityAssessmentImpl(String name, SqlManager manager) { + super(name, new DatabaseVulnerabilityAssessmentInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseVulnerabilityAssessmentImpl(DatabaseVulnerabilityAssessmentInner 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() { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.manager().inner().managedDatabaseVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.manager().inner().managedDatabaseVulnerabilityAssessments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.manager().inner().managedDatabaseVulnerabilityAssessments(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.inner().recurringScans(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public String storageContainerSasKey() { + return this.inner().storageContainerSasKey(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.inner().withStorageContainerPath(storageContainerPath); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.inner().withRecurringScans(recurringScans); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.inner().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..ca0d10de1ccc2 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentInner.java @@ -0,0 +1,131 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentInner extends ProxyResource { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "properties.storageContainerPath", required = true) + private String storageContainerPath; + + /** + * A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is + * required. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /** + * Specifies the identifier key of the vulnerability assessment storage + * account. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @param storageContainerPath the storageContainerPath value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.storageContainerSasKey; + } + + /** + * Set a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get specifies the identifier key of the vulnerability assessment storage account. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the vulnerability assessment storage account. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurring scans settings. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurring scans settings. + * + * @param recurringScans the recurringScans value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java new file mode 100644 index 0000000000000..a2f3fef0d0a6e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java @@ -0,0 +1,120 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentRuleBaseline; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentPolicyBaselineName; + +class DatabaseVulnerabilityAssessmentRuleBaselineImpl extends CreatableUpdatableImpl implements DatabaseVulnerabilityAssessmentRuleBaseline, DatabaseVulnerabilityAssessmentRuleBaseline.Definition, DatabaseVulnerabilityAssessmentRuleBaseline.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + private String ruleId; + private VulnerabilityAssessmentPolicyBaselineName baselineName; + private List cbaselineResults; + private List ubaselineResults; + + DatabaseVulnerabilityAssessmentRuleBaselineImpl(String name, SqlManager manager) { + super(name, new DatabaseVulnerabilityAssessmentRuleBaselineInner()); + this.manager = manager; + // Set resource name + this.baselineName = name; + // + } + + DatabaseVulnerabilityAssessmentRuleBaselineImpl(DatabaseVulnerabilityAssessmentRuleBaselineInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.baselineName = 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"); + this.ruleId = IdParsingUtils.getValueFromIdByName(inner.id(), "rules"); + this.baselineName = IdParsingUtils.getValueFromIdByName(inner.id(), "baselines"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentRuleBaselines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.ruleId, this.baselineName, this.cbaselineResults) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentRuleBaselines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.ruleId, this.baselineName, this.ubaselineResults) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentRuleBaselines(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.ruleId, this.baselineName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List baselineResults() { + return this.inner().baselineResults(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withExistingRule(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + this.ruleId = ruleId; + return this; + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withBaselineResults(List baselineResults) { + if (isInCreateMode()) { + this.cbaselineResults = baselineResults; + } else { + this.ubaselineResults = baselineResults; + } + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java new file mode 100644 index 0000000000000..4edbff7ffbafc --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java @@ -0,0 +1,48 @@ +/** + * 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_10_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment rule baseline. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentRuleBaselineInner extends ProxyResource { + /** + * The rule baseline result. + */ + @JsonProperty(value = "properties.baselineResults", required = true) + private List baselineResults; + + /** + * Get the rule baseline result. + * + * @return the baselineResults value + */ + public List baselineResults() { + return this.baselineResults; + } + + /** + * Set the rule baseline result. + * + * @param baselineResults the baselineResults value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineInner object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner withBaselineResults(List baselineResults) { + this.baselineResults = baselineResults; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java index 600bda466a785..085c9d4b32120 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java @@ -13,7 +13,7 @@ import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans; import rx.Observable; import rx.functions.Func1; -import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanRecord; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerVulnerabilityAssessmentScanRecord; import com.microsoft.azure.Page; import rx.Completable; import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScansExport; @@ -30,8 +30,8 @@ public SqlManager manager() { return this.manager; } - private VulnerabilityAssessmentScanRecordImpl wrapVulnerabilityAssessmentScanRecordModel(VulnerabilityAssessmentScanRecordInner inner) { - return new VulnerabilityAssessmentScanRecordImpl(inner, manager()); + private ServerVulnerabilityAssessmentScanRecordImpl wrapServerVulnerabilityAssessmentScanRecordModel(VulnerabilityAssessmentScanRecordInner inner) { + return new ServerVulnerabilityAssessmentScanRecordImpl(inner, manager()); } private Observable getVulnerabilityAssessmentScanRecordInnerUsingDatabaseVulnerabilityAssessmentScansInnerAsync(String id) { @@ -44,19 +44,19 @@ private Observable getVulnerabilityAsses } @Override - public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { DatabaseVulnerabilityAssessmentScansInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, databaseName, scanId) - .map(new Func1() { + .map(new Func1() { @Override - public VulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { - return wrapVulnerabilityAssessmentScanRecordModel(inner); + public ServerVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapServerVulnerabilityAssessmentScanRecordModel(inner); } }); } @Override - public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { DatabaseVulnerabilityAssessmentScansInner client = this.inner(); return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) .flatMapIterable(new Func1, Iterable>() { @@ -65,10 +65,10 @@ public Iterable call(Page() { + .map(new Func1() { @Override - public VulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { - return wrapVulnerabilityAssessmentScanRecordModel(inner); + public ServerVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapServerVulnerabilityAssessmentScanRecordModel(inner); } }); } diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java new file mode 100644 index 0000000000000..446f18dc0e306 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,72 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentRuleBaselines; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentRuleBaseline; +import rx.Completable; + +class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl extends WrapperImpl implements ManagedDatabaseVulnerabilityAssessmentRuleBaselines { + private final SqlManager manager; + + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl(SqlManager manager) { + super(manager.inner().managedDatabaseVulnerabilityAssessmentRuleBaselines()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineImpl defineBaseline(String name) { + return wrapBaselineModel(name); + } + + private DatabaseVulnerabilityAssessmentRuleBaselineImpl wrapBaselineModel(String name) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(name, this.manager()); + } + + private DatabaseVulnerabilityAssessmentRuleBaselineImpl wrapDatabaseVulnerabilityAssessmentRuleBaselineModel(DatabaseVulnerabilityAssessmentRuleBaselineInner inner) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner, manager()); + } + + private Observable getDatabaseVulnerabilityAssessmentRuleBaselineInnerUsingManagedDatabaseVulnerabilityAssessmentRuleBaselinesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + String ruleId = IdParsingUtils.getValueFromIdByName(id, "rules"); + String baselineName = IdParsingUtils.getValueFromIdByName(id, "baselines"); + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaseline call(DatabaseVulnerabilityAssessmentRuleBaselineInner inner) { + return wrapDatabaseVulnerabilityAssessmentRuleBaselineModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java new file mode 100644 index 0000000000000..96c9069ddde89 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner.java @@ -0,0 +1,408 @@ +/** + * 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_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentPolicyBaselineName; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedDatabaseVulnerabilityAssessmentRuleBaselines. + */ +public class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseVulnerabilityAssessmentRuleBaselines to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentRuleBaselines get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentRuleBaselines createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentRuleBaselines delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner get(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).toBlocking().single().body(); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @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, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName), serviceCallback); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, 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 vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName, baselineResults).toBlocking().single().body(); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @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, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName, baselineResults), serviceCallback); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName, baselineResults).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, List baselineResults) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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."); + } + if (baselineResults == null) { + throw new IllegalArgumentException("Parameter baselineResults is required and cannot be null."); + } + Validator.validate(baselineResults); + final String vulnerabilityAssessmentName = "default"; + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters = new DatabaseVulnerabilityAssessmentRuleBaselineInner(); + parameters.withBaselineResults(baselineResults); + return service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, ruleId, baselineName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @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 database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { + 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 (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (baselineName == null) { + throw new IllegalArgumentException("Parameter baselineName 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 vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..161455d1fb421 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,85 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScansExport; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceVulnerabilityAssessmentScanRecord; + +class ManagedDatabaseVulnerabilityAssessmentScansImpl extends WrapperImpl implements ManagedDatabaseVulnerabilityAssessmentScans { + private final SqlManager manager; + + ManagedDatabaseVulnerabilityAssessmentScansImpl(SqlManager manager) { + super(manager.inner().managedDatabaseVulnerabilityAssessmentScans()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ManagedInstanceVulnerabilityAssessmentScanRecordImpl wrapModel(VulnerabilityAssessmentScanRecordInner inner) { + return new ManagedInstanceVulnerabilityAssessmentScanRecordImpl(inner, manager()); + } + + @Override + public Completable initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.initiateScanAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toCompletable(); + } + + @Override + public Observable exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.exportAsync(resourceGroupName, managedInstanceName, databaseName, scanId) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessmentScansExport call(DatabaseVulnerabilityAssessmentScansExportInner inner) { + return new DatabaseVulnerabilityAssessmentScansExportImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedInstanceVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName, scanId) + .map(new Func1() { + @Override + public ManagedInstanceVulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java new file mode 100644 index 0000000000000..37e2c24ebd007 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java @@ -0,0 +1,717 @@ +/** + * 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_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedDatabaseVulnerabilityAssessmentScans. + */ +public class ManagedDatabaseVulnerabilityAssessmentScansInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseVulnerabilityAssessmentScansService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentScansInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseVulnerabilityAssessmentScansInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseVulnerabilityAssessmentScansService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseVulnerabilityAssessmentScans to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseVulnerabilityAssessmentScansService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans initiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> initiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans beginInitiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> beginInitiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans export" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export") + Observable> export(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> object if successful. + */ + public PagedList listByDatabase(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable> listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + return listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param managedInstanceName The name of the managed instance. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String managedInstanceName, final 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 vulnerabilityAssessmentName = "default"; + return service.listByDatabase(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 VulnerabilityAssessmentScanRecordInner object if successful. + */ + public VulnerabilityAssessmentScanRecordInner get(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, VulnerabilityAssessmentScanRecordInner>() { + @Override + public VulnerabilityAssessmentScanRecordInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, 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); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @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 database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void initiateScan(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().last().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @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 database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @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 database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @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 database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> initiateScanWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + Observable> observable = service.initiateScan(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @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 database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginInitiateScan(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + beginInitiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @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 database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginInitiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginInitiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @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 database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginInitiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return beginInitiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @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 database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginInitiateScanWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.beginInitiateScan(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, 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 = beginInitiateScanDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginInitiateScanDelegate(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); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 DatabaseVulnerabilityAssessmentScansExportInner object if successful. + */ + public DatabaseVulnerabilityAssessmentScansExportInner export(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId), serviceCallback); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable exportAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1, DatabaseVulnerabilityAssessmentScansExportInner>() { + @Override + public DatabaseVulnerabilityAssessmentScansExportInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.export(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, 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 = exportDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportDelegate(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); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> object if successful. + */ + public PagedList listByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable>> listByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..2aebef01be627 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java @@ -0,0 +1,70 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessment; +import rx.Completable; + +class ManagedDatabaseVulnerabilityAssessmentsImpl extends WrapperImpl implements ManagedDatabaseVulnerabilityAssessments { + private final SqlManager manager; + + ManagedDatabaseVulnerabilityAssessmentsImpl(SqlManager manager) { + super(manager.inner().managedDatabaseVulnerabilityAssessments()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseVulnerabilityAssessmentImpl defineVulnerabilityAssessment(String name) { + return wrapVulnerabilityAssessmentModel(name); + } + + private DatabaseVulnerabilityAssessmentImpl wrapVulnerabilityAssessmentModel(String name) { + return new DatabaseVulnerabilityAssessmentImpl(name, this.manager()); + } + + private DatabaseVulnerabilityAssessmentImpl wrapDatabaseVulnerabilityAssessmentModel(DatabaseVulnerabilityAssessmentInner inner) { + return new DatabaseVulnerabilityAssessmentImpl(inner, manager()); + } + + private Observable getDatabaseVulnerabilityAssessmentInnerUsingManagedDatabaseVulnerabilityAssessmentsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + ManagedDatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessment call(DatabaseVulnerabilityAssessmentInner inner) { + return wrapDatabaseVulnerabilityAssessmentModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseVulnerabilityAssessmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, managedInstanceName, databaseName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java new file mode 100644 index 0000000000000..cb03c78870d60 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentsInner.java @@ -0,0 +1,362 @@ +/** + * 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_10_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.HTTP; +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 ManagedDatabaseVulnerabilityAssessments. + */ +public class ManagedDatabaseVulnerabilityAssessmentsInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseVulnerabilityAssessmentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseVulnerabilityAssessmentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseVulnerabilityAssessmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseVulnerabilityAssessments to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseVulnerabilityAssessmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Body DatabaseVulnerabilityAssessmentInner 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_10_01_preview.ManagedDatabaseVulnerabilityAssessments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment 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 DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment 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 the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, DatabaseVulnerabilityAssessmentInner 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 vulnerabilityAssessmentName = "default"; + return service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, 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); + } + + /** + * Removes the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment 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 + */ + public void delete(String resourceGroupName, String managedInstanceName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment 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 deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the database's vulnerability assessment. + * + * @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 database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(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 vulnerabilityAssessmentName = "default"; + return service.delete(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java new file mode 100644 index 0000000000000..728910e627ba2 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentScanRecordImpl.java @@ -0,0 +1,104 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceVulnerabilityAssessmentScanRecord; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanError; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanState; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanTriggerType; + +class ManagedInstanceVulnerabilityAssessmentScanRecordImpl extends IndexableRefreshableWrapperImpl implements ManagedInstanceVulnerabilityAssessmentScanRecord { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + private String scanId; + + ManagedInstanceVulnerabilityAssessmentScanRecordImpl(VulnerabilityAssessmentScanRecordInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.scanId = IdParsingUtils.getValueFromIdByName(inner.id(), "scans"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseVulnerabilityAssessmentScansInner client = this.manager().inner().managedDatabaseVulnerabilityAssessmentScans(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.scanId); + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List errors() { + return this.inner().errors(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer numberOfFailedSecurityChecks() { + return this.inner().numberOfFailedSecurityChecks(); + } + + @Override + public String scanId() { + return this.inner().scanId(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public VulnerabilityAssessmentScanState state() { + return this.inner().state(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.inner().triggerType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java new file mode 100644 index 0000000000000..b33fd50cc4c1b --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ServerVulnerabilityAssessmentScanRecordImpl.java @@ -0,0 +1,104 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerVulnerabilityAssessmentScanRecord; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanError; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanState; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanTriggerType; + +class ServerVulnerabilityAssessmentScanRecordImpl extends IndexableRefreshableWrapperImpl implements ServerVulnerabilityAssessmentScanRecord { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String scanId; + + ServerVulnerabilityAssessmentScanRecordImpl(VulnerabilityAssessmentScanRecordInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.scanId = IdParsingUtils.getValueFromIdByName(inner.id(), "scans"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + DatabaseVulnerabilityAssessmentScansInner client = this.manager().inner().databaseVulnerabilityAssessmentScans(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.scanId); + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List errors() { + return this.inner().errors(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer numberOfFailedSecurityChecks() { + return this.inner().numberOfFailedSecurityChecks(); + } + + @Override + public String scanId() { + return this.inner().scanId(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public VulnerabilityAssessmentScanState state() { + return this.inner().state(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.inner().triggerType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java index 296cf77e06882..0ea31b9c9e0e8 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java @@ -171,6 +171,45 @@ public DatabaseVulnerabilityAssessmentScansInner databaseVulnerabilityAssessment return this.databaseVulnerabilityAssessmentScans; } + /** + * The ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + */ + private ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner managedDatabaseVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + * @return the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner object. + */ + public ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner managedDatabaseVulnerabilityAssessmentRuleBaselines() { + return this.managedDatabaseVulnerabilityAssessmentRuleBaselines; + } + + /** + * The ManagedDatabaseVulnerabilityAssessmentScansInner object to access its operations. + */ + private ManagedDatabaseVulnerabilityAssessmentScansInner managedDatabaseVulnerabilityAssessmentScans; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentScansInner object to access its operations. + * @return the ManagedDatabaseVulnerabilityAssessmentScansInner object. + */ + public ManagedDatabaseVulnerabilityAssessmentScansInner managedDatabaseVulnerabilityAssessmentScans() { + return this.managedDatabaseVulnerabilityAssessmentScans; + } + + /** + * The ManagedDatabaseVulnerabilityAssessmentsInner object to access its operations. + */ + private ManagedDatabaseVulnerabilityAssessmentsInner managedDatabaseVulnerabilityAssessments; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentsInner object to access its operations. + * @return the ManagedDatabaseVulnerabilityAssessmentsInner object. + */ + public ManagedDatabaseVulnerabilityAssessmentsInner managedDatabaseVulnerabilityAssessments() { + return this.managedDatabaseVulnerabilityAssessments; + } + /** * The CapabilitiesInner object to access its operations. */ @@ -326,6 +365,9 @@ protected void initialize() { this.databaseOperations = new DatabaseOperationsInner(restClient().retrofit(), this); this.elasticPoolOperations = new ElasticPoolOperationsInner(restClient().retrofit(), this); this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansInner(restClient().retrofit(), this); + this.managedDatabaseVulnerabilityAssessmentRuleBaselines = new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesInner(restClient().retrofit(), this); + this.managedDatabaseVulnerabilityAssessmentScans = new ManagedDatabaseVulnerabilityAssessmentScansInner(restClient().retrofit(), this); + this.managedDatabaseVulnerabilityAssessments = new ManagedDatabaseVulnerabilityAssessmentsInner(restClient().retrofit(), this); this.capabilities = new CapabilitiesInner(restClient().retrofit(), this); this.databases = new DatabasesInner(restClient().retrofit(), this); this.elasticPools = new ElasticPoolsInner(restClient().retrofit(), this); diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java index 6677354b17e33..f76a2962112b5 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java @@ -19,6 +19,9 @@ import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperations; import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperations; import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentRuleBaselines; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedDatabaseVulnerabilityAssessments; import com.microsoft.azure.management.sql.v2017_10_01_preview.Capabilities; import com.microsoft.azure.management.sql.v2017_10_01_preview.Databases; import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPools; @@ -38,6 +41,9 @@ public final class SqlManager extends ManagerCore