
com.pulumi.azurenative.authorization.PolicyExemption 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.PolicyExemptionArgs;
import com.pulumi.azurenative.authorization.outputs.ResourceSelectorResponse;
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.Optional;
import javax.annotation.Nullable;
/**
* The policy exemption.
* Azure REST API version: 2022-07-01-preview. Prior API version in Azure Native 1.x: 2020-07-01-preview.
*
* ## Example Usage
* ### Create or update a policy exemption
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.authorization.PolicyExemption;
* import com.pulumi.azurenative.authorization.PolicyExemptionArgs;
* 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 policyExemption = new PolicyExemption("policyExemption", PolicyExemptionArgs.builder()
* .description("Exempt demo cluster from limit sku")
* .displayName("Exempt demo cluster")
* .exemptionCategory("Waiver")
* .metadata(Map.of("reason", "Temporary exemption for a expensive VM demo"))
* .policyAssignmentId("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement")
* .policyDefinitionReferenceIds("Limit_Skus")
* .policyExemptionName("DemoExpensiveVM")
* .scope("subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster")
* .build());
*
* }
* }
*
* }
*
* ### Create or update a policy exemption with resource selectors
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.authorization.PolicyExemption;
* import com.pulumi.azurenative.authorization.PolicyExemptionArgs;
* import com.pulumi.azurenative.authorization.inputs.ResourceSelectorArgs;
* 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 policyExemption = new PolicyExemption("policyExemption", PolicyExemptionArgs.builder()
* .assignmentScopeValidation("Default")
* .description("Exempt demo cluster from limit sku")
* .displayName("Exempt demo cluster")
* .exemptionCategory("Waiver")
* .metadata(Map.of("reason", "Temporary exemption for a expensive VM demo"))
* .policyAssignmentId("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement")
* .policyDefinitionReferenceIds("Limit_Skus")
* .policyExemptionName("DemoExpensiveVM")
* .resourceSelectors(ResourceSelectorArgs.builder()
* .name("SDPRegions")
* .selectors(SelectorArgs.builder()
* .in(
* "eastus2euap",
* "centraluseuap")
* .kind("resourceLocation")
* .build())
* .build())
* .scope("subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster")
* .build());
*
* }
* }
*
* }
*
*
* ## Import
*
* An existing resource can be imported using its type token, name, and identifier, e.g.
*
* ```sh
* $ pulumi import azure-native:authorization:PolicyExemption DemoExpensiveVM /{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}
* ```
*
*/
@ResourceType(type="azure-native:authorization:PolicyExemption")
public class PolicyExemption extends com.pulumi.resources.CustomResource {
/**
* The option whether validate the exemption is at or under the assignment scope.
*
*/
@Export(name="assignmentScopeValidation", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> assignmentScopeValidation;
/**
* @return The option whether validate the exemption is at or under the assignment scope.
*
*/
public Output> assignmentScopeValidation() {
return Codegen.optional(this.assignmentScopeValidation);
}
/**
* The description of the policy exemption.
*
*/
@Export(name="description", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> description;
/**
* @return The description of the policy exemption.
*
*/
public Output> description() {
return Codegen.optional(this.description);
}
/**
* The display name of the policy exemption.
*
*/
@Export(name="displayName", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> displayName;
/**
* @return The display name of the policy exemption.
*
*/
public Output> displayName() {
return Codegen.optional(this.displayName);
}
/**
* The policy exemption category. Possible values are Waiver and Mitigated.
*
*/
@Export(name="exemptionCategory", refs={String.class}, tree="[0]")
private Output exemptionCategory;
/**
* @return The policy exemption category. Possible values are Waiver and Mitigated.
*
*/
public Output exemptionCategory() {
return this.exemptionCategory;
}
/**
* The expiration date and time (in UTC ISO 8601 format yyyy-MM-ddTHH:mm:ssZ) of the policy exemption.
*
*/
@Export(name="expiresOn", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> expiresOn;
/**
* @return The expiration date and time (in UTC ISO 8601 format yyyy-MM-ddTHH:mm:ssZ) of the policy exemption.
*
*/
public Output> expiresOn() {
return Codegen.optional(this.expiresOn);
}
/**
* The policy exemption 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 exemption 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 name of the policy exemption.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the policy exemption.
*
*/
public Output name() {
return this.name;
}
/**
* The ID of the policy assignment that is being exempted.
*
*/
@Export(name="policyAssignmentId", refs={String.class}, tree="[0]")
private Output policyAssignmentId;
/**
* @return The ID of the policy assignment that is being exempted.
*
*/
public Output policyAssignmentId() {
return this.policyAssignmentId;
}
/**
* The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition.
*
*/
@Export(name="policyDefinitionReferenceIds", refs={List.class,String.class}, tree="[0,1]")
private Output* @Nullable */ List> policyDefinitionReferenceIds;
/**
* @return The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition.
*
*/
public Output>> policyDefinitionReferenceIds() {
return Codegen.optional(this.policyDefinitionReferenceIds);
}
/**
* The resource selector list to filter policies by resource properties.
*
*/
@Export(name="resourceSelectors", refs={List.class,ResourceSelectorResponse.class}, tree="[0,1]")
private Output* @Nullable */ List> resourceSelectors;
/**
* @return The resource selector list to filter policies by resource properties.
*
*/
public Output>> resourceSelectors() {
return Codegen.optional(this.resourceSelectors);
}
/**
* Azure Resource Manager metadata containing createdBy and modifiedBy information.
*
*/
@Export(name="systemData", refs={SystemDataResponse.class}, tree="[0]")
private Output systemData;
/**
* @return Azure Resource Manager metadata containing createdBy and modifiedBy information.
*
*/
public Output systemData() {
return this.systemData;
}
/**
* The type of the resource (Microsoft.Authorization/policyExemptions).
*
*/
@Export(name="type", refs={String.class}, tree="[0]")
private Output type;
/**
* @return The type of the resource (Microsoft.Authorization/policyExemptions).
*
*/
public Output type() {
return this.type;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public PolicyExemption(java.lang.String name) {
this(name, PolicyExemptionArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public PolicyExemption(java.lang.String name, PolicyExemptionArgs 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 PolicyExemption(java.lang.String name, PolicyExemptionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:authorization:PolicyExemption", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private PolicyExemption(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:authorization:PolicyExemption", name, null, makeResourceOptions(options, id), false);
}
private static PolicyExemptionArgs makeArgs(PolicyExemptionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? PolicyExemptionArgs.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/v20200701preview:PolicyExemption").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20220701preview:PolicyExemption").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 PolicyExemption get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new PolicyExemption(name, id, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy