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

com.pulumi.gitlab.DeployToken Maven / Gradle / Ivy

There is a newer version: 8.4.0
Show 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.gitlab;

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.gitlab.DeployTokenArgs;
import com.pulumi.gitlab.Utilities;
import com.pulumi.gitlab.inputs.DeployTokenState;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * The `gitlab.DeployToken` resource allows to manage the lifecycle of group and project deploy tokens.
 * 
 * **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/deploy_tokens.html)
 * 
 * ## Import
 * 
 * GitLab deploy tokens can be imported using an id made up of `{type}:{type_id}:{deploy_token_id}`, where type is one of: project, group.
 * 
 * ```sh
 * $ pulumi import gitlab:index/deployToken:DeployToken group_token group:1:3
 * ```
 * 
 * ```sh
 * $ pulumi import gitlab:index/deployToken:DeployToken project_token project:1:4
 * ```
 * 
 * Note: the `token` resource attribute is not available for imported resources as this information cannot be read from the GitLab API.
 * 
 */
@ResourceType(type="gitlab:index/deployToken:DeployToken")
public class DeployToken extends com.pulumi.resources.CustomResource {
    /**
     * The id of the deploy token.
     * 
     */
    @Export(name="deployTokenId", refs={Integer.class}, tree="[0]")
    private Output deployTokenId;

    /**
     * @return The id of the deploy token.
     * 
     */
    public Output deployTokenId() {
        return this.deployTokenId;
    }
    /**
     * Time the token will expire it, RFC3339 format. Will not expire per default.
     * 
     */
    @Export(name="expiresAt", refs={String.class}, tree="[0]")
    private Output expiresAt;

    /**
     * @return Time the token will expire it, RFC3339 format. Will not expire per default.
     * 
     */
    public Output> expiresAt() {
        return Codegen.optional(this.expiresAt);
    }
    /**
     * The name or id of the group to add the deploy token to.
     * 
     */
    @Export(name="group", refs={String.class}, tree="[0]")
    private Output group;

    /**
     * @return The name or id of the group to add the deploy token to.
     * 
     */
    public Output> group() {
        return Codegen.optional(this.group);
    }
    /**
     * A name to describe the deploy token with.
     * 
     */
    @Export(name="name", refs={String.class}, tree="[0]")
    private Output name;

    /**
     * @return A name to describe the deploy token with.
     * 
     */
    public Output name() {
        return this.name;
    }
    /**
     * The name or id of the project to add the deploy token to.
     * 
     */
    @Export(name="project", refs={String.class}, tree="[0]")
    private Output project;

    /**
     * @return The name or id of the project to add the deploy token to.
     * 
     */
    public Output> project() {
        return Codegen.optional(this.project);
    }
    /**
     * Valid values: `read_repository`, `read_registry`, `read_package_registry`, `write_registry`, `write_package_registry`.
     * 
     */
    @Export(name="scopes", refs={List.class,String.class}, tree="[0,1]")
    private Output> scopes;

    /**
     * @return Valid values: `read_repository`, `read_registry`, `read_package_registry`, `write_registry`, `write_package_registry`.
     * 
     */
    public Output> scopes() {
        return this.scopes;
    }
    /**
     * The secret token. This is only populated when creating a new deploy token. **Note**: The token is not available for imported resources.
     * 
     */
    @Export(name="token", refs={String.class}, tree="[0]")
    private Output token;

    /**
     * @return The secret token. This is only populated when creating a new deploy token. **Note**: The token is not available for imported resources.
     * 
     */
    public Output token() {
        return this.token;
    }
    /**
     * A username for the deploy token. Default is `gitlab+deploy-token-{n}`.
     * 
     */
    @Export(name="username", refs={String.class}, tree="[0]")
    private Output username;

    /**
     * @return A username for the deploy token. Default is `gitlab+deploy-token-{n}`.
     * 
     */
    public Output username() {
        return this.username;
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public DeployToken(java.lang.String name) {
        this(name, DeployTokenArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public DeployToken(java.lang.String name, DeployTokenArgs 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 DeployToken(java.lang.String name, DeployTokenArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("gitlab:index/deployToken:DeployToken", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
    }

    private DeployToken(java.lang.String name, Output id, @Nullable DeployTokenState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("gitlab:index/deployToken:DeployToken", name, state, makeResourceOptions(options, id), false);
    }

    private static DeployTokenArgs makeArgs(DeployTokenArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        if (options != null && options.getUrn().isPresent()) {
            return null;
        }
        return args == null ? DeployTokenArgs.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())
            .additionalSecretOutputs(List.of(
                "token"
            ))
            .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 DeployToken get(java.lang.String name, Output id, @Nullable DeployTokenState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new DeployToken(name, id, state, options);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy