All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.management.Lock Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 6.10.0-alpha.1731737215
Show newest version
// *** 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.management;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.management.LockArgs;
import com.pulumi.azure.management.inputs.LockState;
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.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages a Management Lock which is scoped to a Subscription, Resource Group or Resource.
 * 
 * ## Example Usage
 * 
 * ### Subscription Level Lock)
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.CoreFunctions;
 * import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
 * import com.pulumi.azure.management.Lock;
 * import com.pulumi.azure.management.LockArgs;
 * 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) {
 *         final var current = CoreFunctions.getSubscription();
 * 
 *         var subscription_level = new Lock("subscription-level", LockArgs.builder()
 *             .name("subscription-level")
 *             .scope(current.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
 *             .lockLevel("CanNotDelete")
 *             .notes("Items can't be deleted in this subscription!")
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ### Resource Group Level Lock) * * <!--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.management.Lock;
 * import com.pulumi.azure.management.LockArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("locked-resource-group")
 *             .location("West Europe")
 *             .build());
 * 
 *         var resource_group_level = new Lock("resource-group-level", LockArgs.builder()
 *             .name("resource-group-level")
 *             .scope(example.id())
 *             .lockLevel("ReadOnly")
 *             .notes("This Resource Group is Read-Only")
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ### Resource Level Lock) * * <!--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.PublicIp;
 * import com.pulumi.azure.network.PublicIpArgs;
 * import com.pulumi.azure.management.Lock;
 * import com.pulumi.azure.management.LockArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("locked-resource-group")
 *             .location("West Europe")
 *             .build());
 * 
 *         var examplePublicIp = new PublicIp("examplePublicIp", PublicIpArgs.builder()
 *             .name("locked-publicip")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .allocationMethod("Static")
 *             .idleTimeoutInMinutes(30)
 *             .build());
 * 
 *         var public_ip = new Lock("public-ip", LockArgs.builder()
 *             .name("resource-ip")
 *             .scope(examplePublicIp.id())
 *             .lockLevel("CanNotDelete")
 *             .notes("Locked because it's needed by a third-party")
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Management Locks can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:management/lock:Lock lock1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Authorization/locks/lock1 * ``` * */ @ResourceType(type="azure:management/lock:Lock") public class Lock extends com.pulumi.resources.CustomResource { /** * Specifies the Level to be used for this Lock. Possible values are `CanNotDelete` and `ReadOnly`. Changing this forces a new resource to be created. * * > **Note:** `CanNotDelete` means authorized users are able to read and modify the resources, but not delete. `ReadOnly` means authorized users can only read from a resource, but they can't modify or delete it. * */ @Export(name="lockLevel", refs={String.class}, tree="[0]") private Output lockLevel; /** * @return Specifies the Level to be used for this Lock. Possible values are `CanNotDelete` and `ReadOnly`. Changing this forces a new resource to be created. * * > **Note:** `CanNotDelete` means authorized users are able to read and modify the resources, but not delete. `ReadOnly` means authorized users can only read from a resource, but they can't modify or delete it. * */ public Output lockLevel() { return this.lockLevel; } /** * Specifies the name of the Management Lock. Changing this forces a new resource to be created. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return Specifies the name of the Management Lock. Changing this forces a new resource to be created. * */ public Output name() { return this.name; } /** * Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created. * */ @Export(name="notes", refs={String.class}, tree="[0]") private Output notes; /** * @return Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created. * */ public Output> notes() { return Codegen.optional(this.notes); } /** * Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created. * */ @Export(name="scope", refs={String.class}, tree="[0]") private Output scope; /** * @return Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created. * */ public Output scope() { return this.scope; } /** * * @param name The _unique_ name of the resulting resource. */ public Lock(java.lang.String name) { this(name, LockArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public Lock(java.lang.String name, LockArgs 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 Lock(java.lang.String name, LockArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:management/lock:Lock", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private Lock(java.lang.String name, Output id, @Nullable LockState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:management/lock:Lock", name, state, makeResourceOptions(options, id), false); } private static LockArgs makeArgs(LockArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? LockArgs.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:managementresource/manangementLock:ManangementLock").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 state * @param options Optional settings to control the behavior of the CustomResource. */ public static Lock get(java.lang.String name, Output id, @Nullable LockState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new Lock(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy