com.pulumi.azurenative.authorization.PolicySetDefinitionAtManagementGroup 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.PolicySetDefinitionAtManagementGroupArgs;
import com.pulumi.azurenative.authorization.outputs.ParameterDefinitionsValueResponse;
import com.pulumi.azurenative.authorization.outputs.PolicyDefinitionGroupResponse;
import com.pulumi.azurenative.authorization.outputs.PolicyDefinitionReferenceResponse;
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 policy set definition.
* Azure REST API version: 2021-06-01. Prior API version in Azure Native 1.x: 2020-09-01.
*
* Other available API versions: 2019-06-01, 2023-04-01, 2024-05-01.
*
* ## Example Usage
* ### Create or update a policy set definition at management group level
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.authorization.PolicySetDefinitionAtManagementGroup;
* import com.pulumi.azurenative.authorization.PolicySetDefinitionAtManagementGroupArgs;
* import com.pulumi.azurenative.authorization.inputs.PolicyDefinitionReferenceArgs;
* 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 policySetDefinitionAtManagementGroup = new PolicySetDefinitionAtManagementGroup("policySetDefinitionAtManagementGroup", PolicySetDefinitionAtManagementGroupArgs.builder()
* .description("Policies to enforce low cost storage SKUs")
* .displayName("Cost Management")
* .managementGroupId("MyManagementGroup")
* .metadata(Map.of("category", "Cost Management"))
* .policyDefinitions(
* PolicyDefinitionReferenceArgs.builder()
* .parameters(Map.of("listOfAllowedSKUs", Map.of("value",
* "Standard_GRS",
* "Standard_LRS")))
* .policyDefinitionId("/providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1")
* .policyDefinitionReferenceId("Limit_Skus")
* .build(),
* PolicyDefinitionReferenceArgs.builder()
* .parameters(Map.ofEntries(
* Map.entry("prefix", Map.of("value", "DeptA")),
* Map.entry("suffix", Map.of("value", "-LC"))
* ))
* .policyDefinitionId("/providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming")
* .policyDefinitionReferenceId("Resource_Naming")
* .build())
* .policySetDefinitionName("CostManagement")
* .build());
*
* }
* }
*
* }
*
* ### Create or update a policy set definition with groups at management group level
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.authorization.PolicySetDefinitionAtManagementGroup;
* import com.pulumi.azurenative.authorization.PolicySetDefinitionAtManagementGroupArgs;
* import com.pulumi.azurenative.authorization.inputs.PolicyDefinitionGroupArgs;
* import com.pulumi.azurenative.authorization.inputs.PolicyDefinitionReferenceArgs;
* 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 policySetDefinitionAtManagementGroup = new PolicySetDefinitionAtManagementGroup("policySetDefinitionAtManagementGroup", PolicySetDefinitionAtManagementGroupArgs.builder()
* .description("Policies to enforce low cost storage SKUs")
* .displayName("Cost Management")
* .managementGroupId("MyManagementGroup")
* .metadata(Map.of("category", "Cost Management"))
* .policyDefinitionGroups(
* PolicyDefinitionGroupArgs.builder()
* .description("Policies designed to control spend within a subscription.")
* .displayName("Cost Management Policies")
* .name("CostSaving")
* .build(),
* PolicyDefinitionGroupArgs.builder()
* .description("Policies that help enforce resource organization standards within a subscription.")
* .displayName("Organizational Policies")
* .name("Organizational")
* .build())
* .policyDefinitions(
* PolicyDefinitionReferenceArgs.builder()
* .groupNames("CostSaving")
* .parameters(Map.of("listOfAllowedSKUs", Map.of("value",
* "Standard_GRS",
* "Standard_LRS")))
* .policyDefinitionId("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1")
* .policyDefinitionReferenceId("Limit_Skus")
* .build(),
* PolicyDefinitionReferenceArgs.builder()
* .groupNames("Organizational")
* .parameters(Map.ofEntries(
* Map.entry("prefix", Map.of("value", "DeptA")),
* Map.entry("suffix", Map.of("value", "-LC"))
* ))
* .policyDefinitionId("/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming")
* .policyDefinitionReferenceId("Resource_Naming")
* .build())
* .policySetDefinitionName("CostManagement")
* .build());
*
* }
* }
*
* }
*
*
* ## Import
*
* An existing resource can be imported using its type token, name, and identifier, e.g.
*
* ```sh
* $ pulumi import azure-native:authorization:PolicySetDefinitionAtManagementGroup CostManagement /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}
* ```
*
*/
@ResourceType(type="azure-native:authorization:PolicySetDefinitionAtManagementGroup")
public class PolicySetDefinitionAtManagementGroup extends com.pulumi.resources.CustomResource {
/**
* The policy set definition description.
*
*/
@Export(name="description", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> description;
/**
* @return The policy set definition description.
*
*/
public Output> description() {
return Codegen.optional(this.description);
}
/**
* The display name of the policy set definition.
*
*/
@Export(name="displayName", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> displayName;
/**
* @return The display name of the policy set definition.
*
*/
public Output> displayName() {
return Codegen.optional(this.displayName);
}
/**
* The policy set 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 set 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 name of the policy set definition.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the policy set definition.
*
*/
public Output name() {
return this.name;
}
/**
* The policy set definition parameters that can be used in policy definition references.
*
*/
@Export(name="parameters", refs={Map.class,String.class,ParameterDefinitionsValueResponse.class}, tree="[0,1,2]")
private Output* @Nullable */ Map> parameters;
/**
* @return The policy set definition parameters that can be used in policy definition references.
*
*/
public Output>> parameters() {
return Codegen.optional(this.parameters);
}
/**
* The metadata describing groups of policy definition references within the policy set definition.
*
*/
@Export(name="policyDefinitionGroups", refs={List.class,PolicyDefinitionGroupResponse.class}, tree="[0,1]")
private Output* @Nullable */ List> policyDefinitionGroups;
/**
* @return The metadata describing groups of policy definition references within the policy set definition.
*
*/
public Output>> policyDefinitionGroups() {
return Codegen.optional(this.policyDefinitionGroups);
}
/**
* An array of policy definition references.
*
*/
@Export(name="policyDefinitions", refs={List.class,PolicyDefinitionReferenceResponse.class}, tree="[0,1]")
private Output> policyDefinitions;
/**
* @return An array of policy definition references.
*
*/
public Output> policyDefinitions() {
return this.policyDefinitions;
}
/**
* 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/policySetDefinitions).
*
*/
@Export(name="type", refs={String.class}, tree="[0]")
private Output type;
/**
* @return The type of the resource (Microsoft.Authorization/policySetDefinitions).
*
*/
public Output type() {
return this.type;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public PolicySetDefinitionAtManagementGroup(java.lang.String name) {
this(name, PolicySetDefinitionAtManagementGroupArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public PolicySetDefinitionAtManagementGroup(java.lang.String name, PolicySetDefinitionAtManagementGroupArgs 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 PolicySetDefinitionAtManagementGroup(java.lang.String name, PolicySetDefinitionAtManagementGroupArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:authorization:PolicySetDefinitionAtManagementGroup", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private PolicySetDefinitionAtManagementGroup(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:authorization:PolicySetDefinitionAtManagementGroup", name, null, makeResourceOptions(options, id), false);
}
private static PolicySetDefinitionAtManagementGroupArgs makeArgs(PolicySetDefinitionAtManagementGroupArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? PolicySetDefinitionAtManagementGroupArgs.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/v20170601preview:PolicySetDefinitionAtManagementGroup").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20180301:PolicySetDefinitionAtManagementGroup").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20180501:PolicySetDefinitionAtManagementGroup").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20190101:PolicySetDefinitionAtManagementGroup").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20190601:PolicySetDefinitionAtManagementGroup").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20190901:PolicySetDefinitionAtManagementGroup").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20200301:PolicySetDefinitionAtManagementGroup").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20200901:PolicySetDefinitionAtManagementGroup").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20210601:PolicySetDefinitionAtManagementGroup").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20230401:PolicySetDefinitionAtManagementGroup").build()),
Output.of(Alias.builder().type("azure-native:authorization/v20240501:PolicySetDefinitionAtManagementGroup").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 PolicySetDefinitionAtManagementGroup get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new PolicySetDefinitionAtManagementGroup(name, id, options);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy