com.pulumi.azurenative.sql.LongTermRetentionPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-native Show documentation
Show all versions of azure-native Show documentation
A native Pulumi package for creating and managing Azure resources.
// *** 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.azurenative.sql;
import com.pulumi.azurenative.Utilities;
import com.pulumi.azurenative.sql.LongTermRetentionPolicyArgs;
import com.pulumi.core.Alias;
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.Integer;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* A long term retention policy.
* Azure REST API version: 2021-11-01. Prior API version in Azure Native 1.x: 2020-11-01-preview.
*
* Other available API versions: 2022-11-01-preview, 2023-02-01-preview, 2023-05-01-preview, 2023-08-01-preview, 2024-05-01-preview.
*
* ## Example Usage
* ### Create or update the long term retention policy for the database.
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.sql.LongTermRetentionPolicy;
* import com.pulumi.azurenative.sql.LongTermRetentionPolicyArgs;
* 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 {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
*
* public static void stack(Context ctx) {
* var longTermRetentionPolicy = new LongTermRetentionPolicy("longTermRetentionPolicy", LongTermRetentionPolicyArgs.builder()
* .databaseName("testDatabase")
* .monthlyRetention("P1Y")
* .policyName("default")
* .resourceGroupName("resourceGroup")
* .serverName("testserver")
* .weekOfYear(5)
* .weeklyRetention("P1M")
* .yearlyRetention("P5Y")
* .build());
*
* }
* }
*
* }
*
*
* ## Import
*
* An existing resource can be imported using its type token, name, and identifier, e.g.
*
* ```sh
* $ pulumi import azure-native:sql:LongTermRetentionPolicy default /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}
* ```
*
*/
@ResourceType(type="azure-native:sql:LongTermRetentionPolicy")
public class LongTermRetentionPolicy extends com.pulumi.resources.CustomResource {
/**
* The monthly retention policy for an LTR backup in an ISO 8601 format.
*
*/
@Export(name="monthlyRetention", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> monthlyRetention;
/**
* @return The monthly retention policy for an LTR backup in an ISO 8601 format.
*
*/
public Output> monthlyRetention() {
return Codegen.optional(this.monthlyRetention);
}
/**
* Resource name.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return Resource name.
*
*/
public Output name() {
return this.name;
}
/**
* Resource type.
*
*/
@Export(name="type", refs={String.class}, tree="[0]")
private Output type;
/**
* @return Resource type.
*
*/
public Output type() {
return this.type;
}
/**
* The week of year to take the yearly backup in an ISO 8601 format.
*
*/
@Export(name="weekOfYear", refs={Integer.class}, tree="[0]")
private Output* @Nullable */ Integer> weekOfYear;
/**
* @return The week of year to take the yearly backup in an ISO 8601 format.
*
*/
public Output> weekOfYear() {
return Codegen.optional(this.weekOfYear);
}
/**
* The weekly retention policy for an LTR backup in an ISO 8601 format.
*
*/
@Export(name="weeklyRetention", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> weeklyRetention;
/**
* @return The weekly retention policy for an LTR backup in an ISO 8601 format.
*
*/
public Output> weeklyRetention() {
return Codegen.optional(this.weeklyRetention);
}
/**
* The yearly retention policy for an LTR backup in an ISO 8601 format.
*
*/
@Export(name="yearlyRetention", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> yearlyRetention;
/**
* @return The yearly retention policy for an LTR backup in an ISO 8601 format.
*
*/
public Output> yearlyRetention() {
return Codegen.optional(this.yearlyRetention);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public LongTermRetentionPolicy(java.lang.String name) {
this(name, LongTermRetentionPolicyArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public LongTermRetentionPolicy(java.lang.String name, LongTermRetentionPolicyArgs 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 LongTermRetentionPolicy(java.lang.String name, LongTermRetentionPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:sql:LongTermRetentionPolicy", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private LongTermRetentionPolicy(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:sql:LongTermRetentionPolicy", name, null, makeResourceOptions(options, id), false);
}
private static LongTermRetentionPolicyArgs makeArgs(LongTermRetentionPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? LongTermRetentionPolicyArgs.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())
.aliases(List.of(
Output.of(Alias.builder().type("azure-native:sql/v20170301preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20200202preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20200801preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20201101preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20210201preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20210501preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20210801preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20211101:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20211101preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20220201preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20220501preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20220801preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20221101preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20230201preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20230501preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20230801preview:LongTermRetentionPolicy").build()),
Output.of(Alias.builder().type("azure-native:sql/v20240501preview:LongTermRetentionPolicy").build())
))
.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 options Optional settings to control the behavior of the CustomResource.
*/
public static LongTermRetentionPolicy get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new LongTermRetentionPolicy(name, id, options);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy