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

com.pulumi.aws.iam.GroupPolicy Maven / Gradle / Ivy

// *** 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.aws.iam;

import com.pulumi.aws.Utilities;
import com.pulumi.aws.iam.GroupPolicyArgs;
import com.pulumi.aws.iam.inputs.GroupPolicyState;
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 javax.annotation.Nullable;

/**
 * Provides an IAM policy attached to a group.
 * 
 * > **NOTE:** We suggest using explicit JSON encoding or `aws.iam.getPolicyDocument` when assigning a value to `policy`. They seamlessly translate configuration to JSON, enabling you to maintain consistency within your configuration without the need for context switches. Also, you can sidestep potential complications arising from formatting discrepancies, whitespace inconsistencies, and other nuances inherent to JSON.
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.iam.Group;
 * import com.pulumi.aws.iam.GroupArgs;
 * import com.pulumi.aws.iam.GroupPolicy;
 * import com.pulumi.aws.iam.GroupPolicyArgs;
 * import static com.pulumi.codegen.internal.Serialization.*;
 * 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 myDevelopers = new Group("myDevelopers", GroupArgs.builder()
 *             .name("developers")
 *             .path("/users/")
 *             .build());
 * 
 *         var myDeveloperPolicy = new GroupPolicy("myDeveloperPolicy", GroupPolicyArgs.builder()
 *             .name("my_developer_policy")
 *             .group(myDevelopers.name())
 *             .policy(serializeJson(
 *                 jsonObject(
 *                     jsonProperty("Version", "2012-10-17"),
 *                     jsonProperty("Statement", jsonArray(jsonObject(
 *                         jsonProperty("Action", jsonArray("ec2:Describe*")),
 *                         jsonProperty("Effect", "Allow"),
 *                         jsonProperty("Resource", "*")
 *                     )))
 *                 )))
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Using `pulumi import`, import IAM Group Policies using the `group_name:group_policy_name`. For example: * * ```sh * $ pulumi import aws:iam/groupPolicy:GroupPolicy mypolicy group_of_mypolicy_name:mypolicy_name * ``` * */ @ResourceType(type="aws:iam/groupPolicy:GroupPolicy") public class GroupPolicy extends com.pulumi.resources.CustomResource { /** * The IAM group to attach to the policy. * */ @Export(name="group", refs={String.class}, tree="[0]") private Output group; /** * @return The IAM group to attach to the policy. * */ public Output group() { return this.group; } /** * The name of the policy. If omitted, the provider will * assign a random, unique name. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return The name of the policy. If omitted, the provider will * assign a random, unique name. * */ public Output name() { return this.name; } /** * Creates a unique name beginning with the specified * prefix. Conflicts with `name`. * */ @Export(name="namePrefix", refs={String.class}, tree="[0]") private Output namePrefix; /** * @return Creates a unique name beginning with the specified * prefix. Conflicts with `name`. * */ public Output namePrefix() { return this.namePrefix; } /** * The policy document. This is a JSON formatted string. * */ @Export(name="policy", refs={String.class}, tree="[0]") private Output policy; /** * @return The policy document. This is a JSON formatted string. * */ public Output policy() { return this.policy; } /** * * @param name The _unique_ name of the resulting resource. */ public GroupPolicy(java.lang.String name) { this(name, GroupPolicyArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public GroupPolicy(java.lang.String name, GroupPolicyArgs 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 GroupPolicy(java.lang.String name, GroupPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("aws:iam/groupPolicy:GroupPolicy", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private GroupPolicy(java.lang.String name, Output id, @Nullable GroupPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("aws:iam/groupPolicy:GroupPolicy", name, state, makeResourceOptions(options, id), false); } private static GroupPolicyArgs makeArgs(GroupPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? GroupPolicyArgs.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()) .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 GroupPolicy get(java.lang.String name, Output id, @Nullable GroupPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new GroupPolicy(name, id, state, options); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy