com.pulumi.keycloak.GroupMemberships Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of keycloak Show documentation
Show all versions of keycloak Show documentation
A Pulumi package for creating and managing keycloak cloud 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.keycloak;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import com.pulumi.keycloak.GroupMembershipsArgs;
import com.pulumi.keycloak.Utilities;
import com.pulumi.keycloak.inputs.GroupMembershipsState;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* ## # keycloak.GroupMemberships
*
* Allows for managing a Keycloak group's members.
*
* Note that this resource attempts to be an **authoritative** source over group members.
* When this resource takes control over a group's members, users that are manually added
* to the group will be removed, and users that are manually removed from the group will
* be added upon the next run of `pulumi up`. Eventually, a non-authoritative resource
* for group membership will be added to this provider.
*
* Also note that you should not use `keycloak.GroupMemberships` with a group has been assigned
* as a default group via `keycloak.DefaultGroups`.
*
* This resource **should not** be used to control membership of a group that has its members
* federated from an external source via group mapping.
*
* ### Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.keycloak.Realm;
* import com.pulumi.keycloak.RealmArgs;
* import com.pulumi.keycloak.Group;
* import com.pulumi.keycloak.GroupArgs;
* import com.pulumi.keycloak.User;
* import com.pulumi.keycloak.UserArgs;
* import com.pulumi.keycloak.GroupMemberships;
* import com.pulumi.keycloak.GroupMembershipsArgs;
* 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 realm = new Realm("realm", RealmArgs.builder()
* .realm("my-realm")
* .enabled(true)
* .build());
*
* var group = new Group("group", GroupArgs.builder()
* .realmId(realm.id())
* .name("my-group")
* .build());
*
* var user = new User("user", UserArgs.builder()
* .realmId(realm.id())
* .username("my-user")
* .build());
*
* var groupMembers = new GroupMemberships("groupMembers", GroupMembershipsArgs.builder()
* .realmId(realm.id())
* .groupId(group.id())
* .members(user.username())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ### Argument Reference
*
* The following arguments are supported:
*
* - `realm_id` - (Required) The realm this group exists in.
* - `group_id` - (Required) The ID of the group this resource should manage memberships for.
* - `members` - (Required) An array of usernames that belong to this group.
*
* ### Import
*
* This resource does not support import. Instead of importing, feel free to create this resource
* as if it did not already exist on the server.
*
*/
@ResourceType(type="keycloak:index/groupMemberships:GroupMemberships")
public class GroupMemberships extends com.pulumi.resources.CustomResource {
@Export(name="groupId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> groupId;
public Output> groupId() {
return Codegen.optional(this.groupId);
}
@Export(name="members", refs={List.class,String.class}, tree="[0,1]")
private Output> members;
public Output> members() {
return this.members;
}
@Export(name="realmId", refs={String.class}, tree="[0]")
private Output realmId;
public Output realmId() {
return this.realmId;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public GroupMemberships(java.lang.String name) {
this(name, GroupMembershipsArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public GroupMemberships(java.lang.String name, GroupMembershipsArgs 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 GroupMemberships(java.lang.String name, GroupMembershipsArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("keycloak:index/groupMemberships:GroupMemberships", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private GroupMemberships(java.lang.String name, Output id, @Nullable GroupMembershipsState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("keycloak:index/groupMemberships:GroupMemberships", name, state, makeResourceOptions(options, id), false);
}
private static GroupMembershipsArgs makeArgs(GroupMembershipsArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? GroupMembershipsArgs.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 GroupMemberships get(java.lang.String name, Output id, @Nullable GroupMembershipsState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new GroupMemberships(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy