com.pulumi.keycloak.User 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.
The newest version!
// *** 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.UserArgs;
import com.pulumi.keycloak.Utilities;
import com.pulumi.keycloak.inputs.UserState;
import com.pulumi.keycloak.outputs.UserFederatedIdentity;
import com.pulumi.keycloak.outputs.UserInitialPassword;
import java.lang.Boolean;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Allows for creating and managing Users within Keycloak.
*
* This resource was created primarily to enable the acceptance tests for the `keycloak.Group` resource. Creating users within
* Keycloak is not recommended. Instead, users should be federated from external sources by configuring user federation providers
* or identity providers.
*
* ## 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.User;
* import com.pulumi.keycloak.UserArgs;
* import com.pulumi.keycloak.inputs.UserInitialPasswordArgs;
* 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 }{{@code
* public static void main(String[] args) }{{@code
* Pulumi.run(App::stack);
* }}{@code
*
* public static void stack(Context ctx) }{{@code
* var realm = new Realm("realm", RealmArgs.builder()
* .realm("my-realm")
* .enabled(true)
* .build());
*
* var user = new User("user", UserArgs.builder()
* .realmId(realm.id())
* .username("bob")
* .enabled(true)
* .email("bob}{@literal @}{@code domain.com")
* .firstName("Bob")
* .lastName("Bobson")
* .build());
*
* var userWithInitialPassword = new User("userWithInitialPassword", UserArgs.builder()
* .realmId(realm.id())
* .username("alice")
* .enabled(true)
* .email("alice}{@literal @}{@code domain.com")
* .firstName("Alice")
* .lastName("Aliceberg")
* .attributes(Map.ofEntries(
* Map.entry("foo", "bar"),
* Map.entry("multivalue", "value1##value2")
* ))
* .initialPassword(UserInitialPasswordArgs.builder()
* .value("some password")
* .temporary(true)
* .build())
* .build());
*
* }}{@code
* }}{@code
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Users can be imported using the format `{{realm_id}}/{{user_id}}`, where `user_id` is the unique ID that Keycloak
*
* assigns to the user upon creation. This value can be found in the GUI when editing the user.
*
* Example:
*
* bash
*
* ```sh
* $ pulumi import keycloak:index/user:User user my-realm/60c3f971-b1d3-4b3a-9035-d16d7540a5e4
* ```
*
*/
@ResourceType(type="keycloak:index/user:User")
public class User extends com.pulumi.resources.CustomResource {
/**
* A map representing attributes for the user. In order to add multivalue attributes, use `##` to seperate the values. Max length for each value is 255 chars
*
*/
@Export(name="attributes", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> attributes;
/**
* @return A map representing attributes for the user. In order to add multivalue attributes, use `##` to seperate the values. Max length for each value is 255 chars
*
*/
public Output>> attributes() {
return Codegen.optional(this.attributes);
}
/**
* The user's email.
*
*/
@Export(name="email", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> email;
/**
* @return The user's email.
*
*/
public Output> email() {
return Codegen.optional(this.email);
}
/**
* Whether the email address was validated or not. Default to `false`.
*
*/
@Export(name="emailVerified", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> emailVerified;
/**
* @return Whether the email address was validated or not. Default to `false`.
*
*/
public Output> emailVerified() {
return Codegen.optional(this.emailVerified);
}
/**
* When false, this user cannot log in. Defaults to `true`.
*
*/
@Export(name="enabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> enabled;
/**
* @return When false, this user cannot log in. Defaults to `true`.
*
*/
public Output> enabled() {
return Codegen.optional(this.enabled);
}
/**
* When specified, the user will be linked to a federated identity provider. Refer to the federated user example for more details.
*
*/
@Export(name="federatedIdentities", refs={List.class,UserFederatedIdentity.class}, tree="[0,1]")
private Output* @Nullable */ List> federatedIdentities;
/**
* @return When specified, the user will be linked to a federated identity provider. Refer to the federated user example for more details.
*
*/
public Output>> federatedIdentities() {
return Codegen.optional(this.federatedIdentities);
}
/**
* The user's first name.
*
*/
@Export(name="firstName", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> firstName;
/**
* @return The user's first name.
*
*/
public Output> firstName() {
return Codegen.optional(this.firstName);
}
/**
* When given, the user's initial password will be set. This attribute is only respected during initial user creation.
*
*/
@Export(name="initialPassword", refs={UserInitialPassword.class}, tree="[0]")
private Output* @Nullable */ UserInitialPassword> initialPassword;
/**
* @return When given, the user's initial password will be set. This attribute is only respected during initial user creation.
*
*/
public Output> initialPassword() {
return Codegen.optional(this.initialPassword);
}
/**
* The user's last name.
*
*/
@Export(name="lastName", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> lastName;
/**
* @return The user's last name.
*
*/
public Output> lastName() {
return Codegen.optional(this.lastName);
}
/**
* The realm this user belongs to.
*
*/
@Export(name="realmId", refs={String.class}, tree="[0]")
private Output realmId;
/**
* @return The realm this user belongs to.
*
*/
public Output realmId() {
return this.realmId;
}
/**
* A list of required user actions.
*
*/
@Export(name="requiredActions", refs={List.class,String.class}, tree="[0,1]")
private Output* @Nullable */ List> requiredActions;
/**
* @return A list of required user actions.
*
*/
public Output>> requiredActions() {
return Codegen.optional(this.requiredActions);
}
/**
* The unique username of this user.
*
*/
@Export(name="username", refs={String.class}, tree="[0]")
private Output username;
/**
* @return The unique username of this user.
*
*/
public Output username() {
return this.username;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public User(java.lang.String name) {
this(name, UserArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public User(java.lang.String name, UserArgs 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 User(java.lang.String name, UserArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("keycloak:index/user:User", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private User(java.lang.String name, Output id, @Nullable UserState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("keycloak:index/user:User", name, state, makeResourceOptions(options, id), false);
}
private static UserArgs makeArgs(UserArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? UserArgs.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 User get(java.lang.String name, Output id, @Nullable UserState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new User(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy