com.pulumi.azurenative.authorization.PolicyDefinitionVersion 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.authorization;
import com.pulumi.azurenative.Utilities;
import com.pulumi.azurenative.authorization.PolicyDefinitionVersionArgs;
import com.pulumi.azurenative.authorization.outputs.ParameterDefinitionsValueResponse;
import com.pulumi.azurenative.authorization.outputs.SystemDataResponse;
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.Object;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* The ID of the policy definition version.
* Azure REST API version: 2023-04-01.
*
* Other available API versions: 2024-05-01.
*
* ## Example Usage
* ### Create or update a policy definition version
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.authorization.PolicyDefinitionVersion;
* import com.pulumi.azurenative.authorization.PolicyDefinitionVersionArgs;
* 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 policyDefinitionVersion = new PolicyDefinitionVersion("policyDefinitionVersion", PolicyDefinitionVersionArgs.builder()
* .description("Force resource names to begin with given 'prefix' and/or end with given 'suffix'")
* .displayName("Enforce resource naming convention")
* .metadata(Map.of("category", "Naming"))
* .mode("All")
* .parameters(Map.ofEntries(
* Map.entry("prefix", Map.ofEntries(
* Map.entry("metadata", Map.ofEntries(
* Map.entry("description", "Resource name prefix"),
* Map.entry("displayName", "Prefix")
* )),
* Map.entry("type", "String")
* )),
* Map.entry("suffix", Map.ofEntries(
* Map.entry("metadata", Map.ofEntries(
* Map.entry("description", "Resource name suffix"),
* Map.entry("displayName", "Suffix")
* )),
* Map.entry("type", "String")
* ))
* ))
* .policyDefinitionName("ResourceNaming")
* .policyDefinitionVersion("1.2.1")
* .policyRule(Map.ofEntries(
* Map.entry("if", Map.of("not", Map.ofEntries(
* Map.entry("field", "name"),
* Map.entry("like", "[concat(parameters('prefix'), '*', parameters('suffix'))]")
* ))),
* Map.entry("then", Map.of("effect", "deny"))
* ))
* .version("1.2.1")
* .build());
*
* }
* }
*
* }
*
*
* ## Import
*
* An existing resource can be imported using its type token, name, and identifier, e.g.
*
* ```sh
* $ pulumi import azure-native:authorization:PolicyDefinitionVersion 1.2.1 /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions/{policyDefinitionVersion}
* ```
*
*/
@ResourceType(type="azure-native:authorization:PolicyDefinitionVersion")
public class PolicyDefinitionVersion extends com.pulumi.resources.CustomResource {
/**
* The policy definition description.
*
*/
@Export(name="description", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> description;
/**
* @return The policy definition description.
*
*/
public Output> description() {
return Codegen.optional(this.description);
}
/**
* The display name of the policy definition.
*
*/
@Export(name="displayName", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> displayName;
/**
* @return The display name of the policy definition.
*
*/
public Output> displayName() {
return Codegen.optional(this.displayName);
}
/**
* The policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs.
*
*/
@Export(name="metadata", refs={Object.class}, tree="[0]")
private Output* @Nullable */ Object> metadata;
/**
* @return The policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs.
*
*/
public Output> metadata() {
return Codegen.optional(this.metadata);
}
/**
* The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data.
*
*/
@Export(name="mode", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> mode;
/**
* @return The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data.
*
*/
public Output> mode() {
return Codegen.optional(this.mode);
}
/**
* The name of the policy definition version.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the policy definition version.
*
*/
public Output name() {
return this.name;
}
/**
* The parameter definitions for parameters used in the policy rule. The keys are the parameter names.
*
*/
@Export(name="parameters", refs={Map.class,String.class,ParameterDefinitionsValueResponse.class}, tree="[0,1,2]")
private Output* @Nullable */ Map> parameters;
/**
* @return The parameter definitions for parameters used in the policy rule. The keys are the parameter names.
*
*/
public Output>> parameters() {
return Codegen.optional(this.parameters);
}
/**
* The policy rule.
*
*/
@Export(name="policyRule", refs={Object.class}, tree="[0]")
private Output* @Nullable */ Object> policyRule;
/**
* @return The policy rule.
*
*/
public Output> policyRule() {
return Codegen.optional(this.policyRule);
}
/**
* The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static.
*
*/
@Export(name="policyType", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> policyType;
/**
* @return The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static.
*
*/
public Output> policyType() {
return Codegen.optional(this.policyType);
}
/**
* The system metadata relating to this resource.
*
*/
@Export(name="systemData", refs={SystemDataResponse.class}, tree="[0]")
private Output systemData;
/**
* @return The system metadata relating to this resource.
*
*/
public Output systemData() {
return this.systemData;
}
/**
* The type of the resource (Microsoft.Authorization/policyDefinitions/versions).
*
*/
@Export(name="type", refs={String.class}, tree="[0]")
private Output type;
/**
* @return The type of the resource (Microsoft.Authorization/policyDefinitions/versions).
*
*/
public Output type() {
return this.type;
}
/**
* The policy definition version in #.#.# format.
*
*/
@Export(name="version", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> version;
/**
* @return The policy definition version in #.#.# format.
*
*/
public Output> version() {
return Codegen.optional(this.version);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public PolicyDefinitionVersion(java.lang.String name) {
this(name, PolicyDefinitionVersionArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public PolicyDefinitionVersion(java.lang.String name, PolicyDefinitionVersionArgs 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 PolicyDefinitionVersion(java.lang.String name, PolicyDefinitionVersionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:authorization:PolicyDefinitionVersion", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private PolicyDefinitionVersion(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:authorization:PolicyDefinitionVersion", name, null, makeResourceOptions(options, id), false);
}
private static PolicyDefinitionVersionArgs makeArgs(PolicyDefinitionVersionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? PolicyDefinitionVersionArgs.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:authorization/v20230401:PolicyDefinitionVersion").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20240501:PolicyDefinitionVersion").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 PolicyDefinitionVersion get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new PolicyDefinitionVersion(name, id, options);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy