com.pulumi.github.UserInvitationAccepter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of github Show documentation
Show all versions of github Show documentation
A Pulumi package for creating and managing github 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.github;
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.github.UserInvitationAccepterArgs;
import com.pulumi.github.Utilities;
import com.pulumi.github.inputs.UserInvitationAccepterState;
import java.lang.Boolean;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Provides a resource to manage GitHub repository collaborator invitations.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.github.Repository;
* import com.pulumi.github.RepositoryArgs;
* import com.pulumi.github.RepositoryCollaborator;
* import com.pulumi.github.RepositoryCollaboratorArgs;
* import com.pulumi.github.UserInvitationAccepter;
* import com.pulumi.github.UserInvitationAccepterArgs;
* 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 example = new Repository("example", RepositoryArgs.builder()
* .name("example-repo")
* .build());
*
* var exampleRepositoryCollaborator = new RepositoryCollaborator("exampleRepositoryCollaborator", RepositoryCollaboratorArgs.builder()
* .repository(example.name())
* .username("example-username")
* .permission("push")
* .build());
*
* var exampleUserInvitationAccepter = new UserInvitationAccepter("exampleUserInvitationAccepter", UserInvitationAccepterArgs.builder()
* .invitationId(exampleRepositoryCollaborator.invitationId())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Allowing empty invitation IDs
*
* Set `allow_empty_id` when using `for_each` over a list of `github_repository_collaborator.invitation_id`'s.
*
* This allows applying a module again when a new `github.RepositoryCollaborator` resource is added to the `for_each` loop.
* This is needed as the `github_repository_collaborator.invitation_id` will be empty after a state refresh when the invitation has been accepted.
*
* Note that when an invitation is accepted manually or by another tool between a state refresh and a `pulumi up` using that refreshed state,
* the plan will contain the invitation ID, but the apply will receive an HTTP 404 from the API since the invitation has already been accepted.
*
* This is tracked in #1157.
*
*/
@ResourceType(type="github:index/userInvitationAccepter:UserInvitationAccepter")
public class UserInvitationAccepter extends com.pulumi.resources.CustomResource {
/**
* Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
*
*/
@Export(name="allowEmptyId", refs={Boolean.class}, tree="[0]")
private Output allowEmptyId;
/**
* @return Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
*
*/
public Output> allowEmptyId() {
return Codegen.optional(this.allowEmptyId);
}
/**
* ID of the invitation to accept. Must be set when `allow_empty_id` is `false`.
*
*/
@Export(name="invitationId", refs={String.class}, tree="[0]")
private Output invitationId;
/**
* @return ID of the invitation to accept. Must be set when `allow_empty_id` is `false`.
*
*/
public Output> invitationId() {
return Codegen.optional(this.invitationId);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public UserInvitationAccepter(java.lang.String name) {
this(name, UserInvitationAccepterArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public UserInvitationAccepter(java.lang.String name, @Nullable UserInvitationAccepterArgs 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 UserInvitationAccepter(java.lang.String name, @Nullable UserInvitationAccepterArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("github:index/userInvitationAccepter:UserInvitationAccepter", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private UserInvitationAccepter(java.lang.String name, Output id, @Nullable UserInvitationAccepterState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("github:index/userInvitationAccepter:UserInvitationAccepter", name, state, makeResourceOptions(options, id), false);
}
private static UserInvitationAccepterArgs makeArgs(@Nullable UserInvitationAccepterArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? UserInvitationAccepterArgs.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 UserInvitationAccepter get(java.lang.String name, Output id, @Nullable UserInvitationAccepterState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new UserInvitationAccepter(name, id, state, options);
}
}