com.pulumi.azure.mssql.ManagedInstanceVulnerabilityAssessment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure Show documentation
Show all versions of azure Show documentation
A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.azure.mssql;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.mssql.ManagedInstanceVulnerabilityAssessmentArgs;
import com.pulumi.azure.mssql.inputs.ManagedInstanceVulnerabilityAssessmentState;
import com.pulumi.azure.mssql.outputs.ManagedInstanceVulnerabilityAssessmentRecurringScans;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Manages the Vulnerability Assessment for an MS Managed Instance.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.network.VirtualNetwork;
* import com.pulumi.azure.network.VirtualNetworkArgs;
* import com.pulumi.azure.network.Subnet;
* import com.pulumi.azure.network.SubnetArgs;
* import com.pulumi.azure.mssql.ManagedInstance;
* import com.pulumi.azure.mssql.ManagedInstanceArgs;
* import com.pulumi.azure.storage.Account;
* import com.pulumi.azure.storage.AccountArgs;
* import com.pulumi.azure.storage.Container;
* import com.pulumi.azure.storage.ContainerArgs;
* import com.pulumi.azure.mssql.ManagedInstanceSecurityAlertPolicy;
* import com.pulumi.azure.mssql.ManagedInstanceSecurityAlertPolicyArgs;
* import com.pulumi.azure.mssql.ManagedInstanceVulnerabilityAssessment;
* import com.pulumi.azure.mssql.ManagedInstanceVulnerabilityAssessmentArgs;
* import com.pulumi.azure.mssql.inputs.ManagedInstanceVulnerabilityAssessmentRecurringScansArgs;
* import com.pulumi.resources.CustomResourceOptions;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
*
* public class App }{{@code
* public static void main(String[] args) }{{@code
* Pulumi.run(App::stack);
* }}{@code
*
* public static void stack(Context ctx) }{{@code
* var example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-resources")
* .location("West Europe")
* .build());
*
* var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
* .name("example")
* .location(example.location())
* .resourceGroupName(example.name())
* .addressSpaces("10.0.0.0/16")
* .build());
*
* var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
* .name("example")
* .resourceGroupName(example.name())
* .virtualNetworkName(exampleVirtualNetwork.name())
* .addressPrefixes("10.0.2.0/24")
* .build());
*
* var exampleManagedInstance = new ManagedInstance("exampleManagedInstance", ManagedInstanceArgs.builder()
* .name("exampleinstance")
* .resourceGroupName(example.name())
* .location(example.location())
* .licenseType("BasePrice")
* .skuName("GP_Gen5")
* .storageSizeInGb(32)
* .subnetId(exampleSubnet.id())
* .vcores(4)
* .administratorLogin("missadministrator")
* .administratorLoginPassword("NCC-1701-D")
* .build());
*
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("accteststorageaccount")
* .resourceGroupName(example.name())
* .location(example.location())
* .accountTier("Standard")
* .accountReplicationType("GRS")
* .build());
*
* var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()
* .name("accteststoragecontainer")
* .storageAccountName(exampleAccount.name())
* .containerAccessType("private")
* .build());
*
* var exampleManagedInstanceSecurityAlertPolicy = new ManagedInstanceSecurityAlertPolicy("exampleManagedInstanceSecurityAlertPolicy", ManagedInstanceSecurityAlertPolicyArgs.builder()
* .resourceGroupName(testAzurermResourceGroup.name())
* .managedInstanceName(test.name())
* .enabled(true)
* .storageEndpoint(testAzurermStorageAccount.primaryBlobEndpoint())
* .storageAccountAccessKey(testAzurermStorageAccount.primaryAccessKey())
* .retentionDays(30)
* .build());
*
* var exampleManagedInstanceVulnerabilityAssessment = new ManagedInstanceVulnerabilityAssessment("exampleManagedInstanceVulnerabilityAssessment", ManagedInstanceVulnerabilityAssessmentArgs.builder()
* .managedInstanceId(exampleManagedInstance.id())
* .storageContainerPath(Output.tuple(exampleAccount.primaryBlobEndpoint(), exampleContainer.name()).applyValue(values -> }{{@code
* var primaryBlobEndpoint = values.t1;
* var name = values.t2;
* return String.format("%s%s/", primaryBlobEndpoint,name);
* }}{@code ))
* .storageAccountAccessKey(exampleAccount.primaryAccessKey())
* .recurringScans(ManagedInstanceVulnerabilityAssessmentRecurringScansArgs.builder()
* .enabled(true)
* .emailSubscriptionAdmins(true)
* .emails(
* "email}{@literal @}{@code example1.com",
* "email}{@literal @}{@code example2.com")
* .build())
* .build(), CustomResourceOptions.builder()
* .dependsOn(exampleManagedInstanceSecurityAlertPolicy)
* .build());
*
* }}{@code
* }}{@code
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* The Vulnerability Assessment can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:mssql/managedInstanceVulnerabilityAssessment:ManagedInstanceVulnerabilityAssessment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acceptanceTestResourceGroup1/providers/Microsoft.Sql/managedInstances/instance1/vulnerabilityAssessments/Default
* ```
*
*/
@ResourceType(type="azure:mssql/managedInstanceVulnerabilityAssessment:ManagedInstanceVulnerabilityAssessment")
public class ManagedInstanceVulnerabilityAssessment extends com.pulumi.resources.CustomResource {
/**
* The id of the MS SQL Managed Instance. Changing this forces a new resource to be created.
*
*/
@Export(name="managedInstanceId", refs={String.class}, tree="[0]")
private Output managedInstanceId;
/**
* @return The id of the MS SQL Managed Instance. Changing this forces a new resource to be created.
*
*/
public Output managedInstanceId() {
return this.managedInstanceId;
}
/**
* The recurring scans settings. The `recurring_scans` block supports fields documented below.
*
*/
@Export(name="recurringScans", refs={ManagedInstanceVulnerabilityAssessmentRecurringScans.class}, tree="[0]")
private Output recurringScans;
/**
* @return The recurring scans settings. The `recurring_scans` block supports fields documented below.
*
*/
public Output recurringScans() {
return this.recurringScans;
}
/**
* Specifies the identifier key of the storage account for vulnerability assessment scan results. If `storage_container_sas_key` isn't specified, `storage_account_access_key` is required.
*
* > **NOTE** The `storage_account_access_key` only applies if the storage account is not behind a virtual network or a firewall.
*
*/
@Export(name="storageAccountAccessKey", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> storageAccountAccessKey;
/**
* @return Specifies the identifier key of the storage account for vulnerability assessment scan results. If `storage_container_sas_key` isn't specified, `storage_account_access_key` is required.
*
* > **NOTE** The `storage_account_access_key` only applies if the storage account is not behind a virtual network or a firewall.
*
*/
public Output> storageAccountAccessKey() {
return Codegen.optional(this.storageAccountAccessKey);
}
/**
* A blob storage container path to hold the scan results (e.g. <https://myStorage.blob.core.windows.net/VaScans/>).
*
*/
@Export(name="storageContainerPath", refs={String.class}, tree="[0]")
private Output storageContainerPath;
/**
* @return A blob storage container path to hold the scan results (e.g. <https://myStorage.blob.core.windows.net/VaScans/>).
*
*/
public Output storageContainerPath() {
return this.storageContainerPath;
}
/**
* A shared access signature (SAS Key) that has write access to the blob container specified in `storage_container_path` parameter. If `storage_account_access_key` isn't specified, `storage_container_sas_key` is required.
*
* > **NOTE** The `storage_container_sas_key` only applies if the storage account is not behind a virtual network or a firewall.
*
*/
@Export(name="storageContainerSasKey", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> storageContainerSasKey;
/**
* @return A shared access signature (SAS Key) that has write access to the blob container specified in `storage_container_path` parameter. If `storage_account_access_key` isn't specified, `storage_container_sas_key` is required.
*
* > **NOTE** The `storage_container_sas_key` only applies if the storage account is not behind a virtual network or a firewall.
*
*/
public Output> storageContainerSasKey() {
return Codegen.optional(this.storageContainerSasKey);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public ManagedInstanceVulnerabilityAssessment(java.lang.String name) {
this(name, ManagedInstanceVulnerabilityAssessmentArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public ManagedInstanceVulnerabilityAssessment(java.lang.String name, ManagedInstanceVulnerabilityAssessmentArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public ManagedInstanceVulnerabilityAssessment(java.lang.String name, ManagedInstanceVulnerabilityAssessmentArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:mssql/managedInstanceVulnerabilityAssessment:ManagedInstanceVulnerabilityAssessment", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private ManagedInstanceVulnerabilityAssessment(java.lang.String name, Output id, @Nullable ManagedInstanceVulnerabilityAssessmentState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:mssql/managedInstanceVulnerabilityAssessment:ManagedInstanceVulnerabilityAssessment", name, state, makeResourceOptions(options, id), false);
}
private static ManagedInstanceVulnerabilityAssessmentArgs makeArgs(ManagedInstanceVulnerabilityAssessmentArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? ManagedInstanceVulnerabilityAssessmentArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.additionalSecretOutputs(List.of(
"storageAccountAccessKey",
"storageContainerSasKey"
))
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static ManagedInstanceVulnerabilityAssessment get(java.lang.String name, Output id, @Nullable ManagedInstanceVulnerabilityAssessmentState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new ManagedInstanceVulnerabilityAssessment(name, id, state, options);
}
}