// *** 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.gcp.workflows;

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.gcp.Utilities;
import com.pulumi.gcp.workflows.WorkflowArgs;
import com.pulumi.gcp.workflows.inputs.WorkflowState;
import java.lang.String;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Workflow program to be executed by Workflows.
 * 
 * To get more information about Workflow, see:
 * 
 * * [API documentation](https://cloud.google.com/workflows/docs/reference/rest/v1/projects.locations.workflows)
 * * How-to Guides
 *     * [Managing Workflows](https://cloud.google.com/workflows/docs/creating-updating-workflow)
 * 
 * ## Example Usage
 * ### Workflow Basic
 * ```java
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.serviceAccount.Account;
 * import com.pulumi.gcp.serviceAccount.AccountArgs;
 * import com.pulumi.gcp.workflows.Workflow;
 * import com.pulumi.gcp.workflows.WorkflowArgs;
 * 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 testAccount = new Account(&#34;testAccount&#34;, AccountArgs.builder()        
 *             .accountId(&#34;my-account&#34;)
 *             .displayName(&#34;Test Service Account&#34;)
 *             .build());
 * 
 *         var example = new Workflow(&#34;example&#34;, WorkflowArgs.builder()        
 *             .region(&#34;us-central1&#34;)
 *             .description(&#34;Magic&#34;)
 *             .serviceAccount(testAccount.id())
 *             .sourceContents(&#34;&#34;&#34;
 * # This is a sample workflow. You can replace it with your source code.
 * #
 * # This workflow does the following:
 * # - reads current time and date information from an external API and stores
 * #   the response in currentTime variable
 * # - retrieves a list of Wikipedia articles related to the day of the week
 * #   from currentTime
 * # - returns the list of articles as an output of the workflow
 * #
 * # Note: In Terraform you need to escape the $$ or it will cause errors.
 * 
 * - getCurrentTime:
 *     call: http.get
 *     args:
 *         url: https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam
 *     result: currentTime
 * - readWikipedia:
 *     call: http.get
 *     args:
 *         url: https://en.wikipedia.org/w/api.php
 *         query:
 *             action: opensearch
 *             search: %s
 *     result: wikiResult
 * - returnOutput:
 *     return: %s
 * &#34;, currentTime.body().dayOfWeek(),wikiResult.body()[1]))
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## Import
 * 
 * This resource does not support import.
 * 
 */
@ResourceType(type="gcp:workflows/workflow:Workflow")
public class Workflow extends com.pulumi.resources.CustomResource {
    /**
     * The timestamp of when the workflow was created in RFC3339 UTC &#34;Zulu&#34; format, with nanosecond resolution and up to nine fractional digits.
     * 
     */
    @Export(name="createTime", type=String.class, parameters={})
    private Output<String> createTime;

    /**
     * @return The timestamp of when the workflow was created in RFC3339 UTC &#34;Zulu&#34; format, with nanosecond resolution and up to nine fractional digits.
     * 
     */
    public Output<String> createTime() {
        return this.createTime;
    }
    /**
     * The KMS key used to encrypt workflow and execution data.
     * Format: projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}
     * 
     */
    @Export(name="cryptoKeyName", type=String.class, parameters={})
    private Output</* @Nullable */ String> cryptoKeyName;

    /**
     * @return The KMS key used to encrypt workflow and execution data.
     * Format: projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}
     * 
     */
    public Output<Optional<String>> cryptoKeyName() {
        return Codegen.optional(this.cryptoKeyName);
    }
    /**
     * Description of the workflow provided by the user. Must be at most 1000 unicode characters long.
     * 
     */
    @Export(name="description", type=String.class, parameters={})
    private Output<String> description;

    /**
     * @return Description of the workflow provided by the user. Must be at most 1000 unicode characters long.
     * 
     */
    public Output<String> description() {
        return this.description;
    }
    /**
     * A set of key/value label pairs to assign to this Workflow.
     * 
     */
    @Export(name="labels", type=Map.class, parameters={String.class, String.class})
    private Output</* @Nullable */ Map<String,String>> labels;

    /**
     * @return A set of key/value label pairs to assign to this Workflow.
     * 
     */
    public Output<Optional<Map<String,String>>> labels() {
        return Codegen.optional(this.labels);
    }
    /**
     * Name of the Workflow.
     * 
     */
    @Export(name="name", type=String.class, parameters={})
    private Output<String> name;

    /**
     * @return Name of the Workflow.
     * 
     */
    public Output<String> name() {
        return this.name;
    }
    /**
     * Creates a unique name beginning with the
     * specified prefix. If this and name are unspecified, a random value is chosen for the name.
     * 
     */
    @Export(name="namePrefix", type=String.class, parameters={})
    private Output<String> namePrefix;

    /**
     * @return Creates a unique name beginning with the
     * specified prefix. If this and name are unspecified, a random value is chosen for the name.
     * 
     */
    public Output<String> namePrefix() {
        return this.namePrefix;
    }
    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     * 
     */
    @Export(name="project", type=String.class, parameters={})
    private Output<String> project;

    /**
     * @return The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     * 
     */
    public Output<String> project() {
        return this.project;
    }
    /**
     * The region of the workflow.
     * 
     */
    @Export(name="region", type=String.class, parameters={})
    private Output</* @Nullable */ String> region;

    /**
     * @return The region of the workflow.
     * 
     */
    public Output<Optional<String>> region() {
        return Codegen.optional(this.region);
    }
    /**
     * The revision of the workflow. A new one is generated if the service account or source contents is changed.
     * 
     */
    @Export(name="revisionId", type=String.class, parameters={})
    private Output<String> revisionId;

    /**
     * @return The revision of the workflow. A new one is generated if the service account or source contents is changed.
     * 
     */
    public Output<String> revisionId() {
        return this.revisionId;
    }
    /**
     * Name of the service account associated with the latest workflow version. This service
     * account represents the identity of the workflow and determines what permissions the workflow has.
     * Format: projects/{project}/serviceAccounts/{account} or {account}.
     * Using - as a wildcard for the {project} or not providing one at all will infer the project from the account.
     * The {account} value can be the email address or the unique_id of the service account.
     * If not provided, workflow will use the project&#39;s default service account.
     * Modifying this field for an existing workflow results in a new workflow revision.
     * 
     */
    @Export(name="serviceAccount", type=String.class, parameters={})
    private Output<String> serviceAccount;

    /**
     * @return Name of the service account associated with the latest workflow version. This service
     * account represents the identity of the workflow and determines what permissions the workflow has.
     * Format: projects/{project}/serviceAccounts/{account} or {account}.
     * Using - as a wildcard for the {project} or not providing one at all will infer the project from the account.
     * The {account} value can be the email address or the unique_id of the service account.
     * If not provided, workflow will use the project&#39;s default service account.
     * Modifying this field for an existing workflow results in a new workflow revision.
     * 
     */
    public Output<String> serviceAccount() {
        return this.serviceAccount;
    }
    /**
     * Workflow code to be executed. The size limit is 32KB.
     * 
     */
    @Export(name="sourceContents", type=String.class, parameters={})
    private Output</* @Nullable */ String> sourceContents;

    /**
     * @return Workflow code to be executed. The size limit is 32KB.
     * 
     */
    public Output<Optional<String>> sourceContents() {
        return Codegen.optional(this.sourceContents);
    }
    /**
     * State of the workflow deployment.
     * 
     */
    @Export(name="state", type=String.class, parameters={})
    private Output<String> state;

    /**
     * @return State of the workflow deployment.
     * 
     */
    public Output<String> state() {
        return this.state;
    }
    /**
     * The timestamp of when the workflow was last updated in RFC3339 UTC &#34;Zulu&#34; format, with nanosecond resolution and up to nine fractional digits.
     * 
     */
    @Export(name="updateTime", type=String.class, parameters={})
    private Output<String> updateTime;

    /**
     * @return The timestamp of when the workflow was last updated in RFC3339 UTC &#34;Zulu&#34; format, with nanosecond resolution and up to nine fractional digits.
     * 
     */
    public Output<String> updateTime() {
        return this.updateTime;
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public Workflow(String name) {
        this(name, WorkflowArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public Workflow(String name, @Nullable WorkflowArgs 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 Workflow(String name, @Nullable WorkflowArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("gcp:workflows/workflow:Workflow", name, args == null ? WorkflowArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
    }

    private Workflow(String name, Output<String> id, @Nullable WorkflowState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("gcp:workflows/workflow:Workflow", name, state, makeResourceOptions(options, id));
    }

    private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output<String> 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 Workflow get(String name, Output<String> id, @Nullable WorkflowState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new Workflow(name, id, state, options);
    }
}
