<reponame>pierskarsenbarg/pulumi-codefresh<gh_stars>0// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
using Pulumi;

namespace PiersKarsenbarg.Codefresh
{
    /// <summary>
    /// ## # Context Resource
    /// 
    /// A Context is an  authentication/configuration that is used by Codefresh system and engine.
    /// There are multiple types of context available in Codefresh but they all have the following main components to define them:
    /// * Name: A unique identifier for the context
    /// * Type: A string representing the type of context
    /// * Data: A data structure that provide the information related to the Context. This differs based on the type of context selected
    ///   For more details of the Context spec see in the [CLI official documentation](https://codefresh-io.github.io/cli/contexts/spec/)
    /// 
    /// ## Supported types
    /// 
    /// Currently the provider support the following types of Context:
    /// * config (Shared Config )
    /// * secret (Shared Secret)
    /// * yaml (YAML Configuration Context)
    /// * secret-yaml (Secret YAML Configuration Context)
    /// 
    /// ### Shared Configuration
    /// A Shared Configuration is the entity in Codefresh that allow to create values in a central place that can then be consumed in pipelines to keep them DRY.
    /// More details in the official [Shared Configuration documentation](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/)
    /// 
    /// #### Example Usage of config (Shared Config)
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using Codefresh = PiersKarsenbarg.Codefresh;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var test_config = new Codefresh.Context("test-config", new()
    ///     {
    ///         Spec = new Codefresh.Inputs.ContextSpecArgs
    ///         {
    ///             Config = new Codefresh.Inputs.ContextSpecConfigArgs
    ///             {
    ///                 Data = 
    ///                 {
    ///                     { "var1", "value1" },
    ///                     { "var2", "value2" },
    ///                 },
    ///             },
    ///         },
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// #### Example Usage of secret (Shared Secret)
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using Codefresh = PiersKarsenbarg.Codefresh;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var test_secret = new Codefresh.Context("test-secret", new()
    ///     {
    ///         Spec = new Codefresh.Inputs.ContextSpecArgs
    ///         {
    ///             Secret = new Codefresh.Inputs.ContextSpecSecretArgs
    ///             {
    ///                 Data = 
    ///                 {
    ///                     { "var1", "value1" },
    ///                     { "var2", "value2" },
    ///                 },
    ///             },
    ///         },
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// #### Example Usage of yaml (YAML Configuration Context)
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using Codefresh = PiersKarsenbarg.Codefresh;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var test_yaml = new Codefresh.Context("test-yaml", new()
    ///     {
    ///         Spec = new Codefresh.Inputs.ContextSpecArgs
    ///         {
    ///             Yaml = @"test:
    ///   nested_value: value1
    ///   list:
    ///     - test2
    ///     - test3
    /// another_element: value
    /// 
    /// ",
    ///         },
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// #### Example Usage of secret-yaml (Secret YAML Configuration Context)
    /// ```csharp
    /// using System.Collections.Generic;
    /// using System.IO;
    /// using Pulumi;
    /// using Codefresh = PiersKarsenbarg.Codefresh;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var test_secret_yaml = new Codefresh.Context("test-secret-yaml", new()
    ///     {
    ///         Spec = new Codefresh.Inputs.ContextSpecArgs
    ///         {
    ///             Secretyaml = File.ReadAllText("test.yaml"),
    ///         },
    ///     });
    /// 
    /// });
    /// ```
    /// </summary>
    [CodefreshResourceType("codefresh:index/context:Context")]
    public partial class Context : global::Pulumi.CustomResource
    {
        /// <summary>
        /// The display name for the context.
        /// </summary>
        [Output("name")]
        public Output<string> Name { get; private set; } = null!;

        /// <summary>
        /// A `spec` block as documented below.
        /// </summary>
        [Output("spec")]
        public Output<Outputs.ContextSpec> Spec { get; private set; } = null!;


        /// <summary>
        /// Create a Context resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public Context(string name, ContextArgs args, CustomResourceOptions? options = null)
            : base("codefresh:index/context:Context", name, args ?? new ContextArgs(), MakeResourceOptions(options, ""))
        {
        }

        private Context(string name, Input<string> id, ContextState? state = null, CustomResourceOptions? options = null)
            : base("codefresh:index/context:Context", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing Context resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static Context Get(string name, Input<string> id, ContextState? state = null, CustomResourceOptions? options = null)
        {
            return new Context(name, id, state, options);
        }
    }

    public sealed class ContextArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The display name for the context.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        /// <summary>
        /// A `spec` block as documented below.
        /// </summary>
        [Input("spec", required: true)]
        public Input<Inputs.ContextSpecArgs> Spec { get; set; } = null!;

        public ContextArgs()
        {
        }
        public static new ContextArgs Empty => new ContextArgs();
    }

    public sealed class ContextState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The display name for the context.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        /// <summary>
        /// A `spec` block as documented below.
        /// </summary>
        [Input("spec")]
        public Input<Inputs.ContextSpecGetArgs>? Spec { get; set; }

        public ContextState()
        {
        }
        public static new ContextState Empty => new ContextState();
    }
}
