<filename>sdk/dotnet/Tencentcloud/Tcr/WebhookTrigger.cs// *** 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 TencentCloudIAC.PulumiPackage.Tencentcloud.Tcr
{
    /// <summary>
    /// Provides a resource to create a tcr webhook_trigger
    /// 
    /// ## Example Usage
    /// 
    /// ```csharp
    /// using Pulumi;
    /// using Tencentcloud = Pulumi.Tencentcloud;
    /// using Tencentcloud = TencentCloudIAC.PulumiPackage.Tencentcloud;
    /// 
    /// class MyStack : Stack
    /// {
    ///     public MyStack()
    ///     {
    ///         var mytcrWebhooktrigger = new Tencentcloud.Tcr.Instance("mytcrWebhooktrigger", new Tencentcloud.Tcr.InstanceArgs
    ///         {
    ///             InstanceType = "basic",
    ///             DeleteBucket = true,
    ///             Tags = 
    ///             {
    ///                 { "test", "test" },
    ///             },
    ///         });
    ///         var myNs = new Tencentcloud.Tcr.Namespace("myNs", new Tencentcloud.Tcr.NamespaceArgs
    ///         {
    ///             InstanceId = mytcrWebhooktrigger.Id,
    ///             IsPublic = true,
    ///             IsAutoScan = true,
    ///             IsPreventVul = true,
    ///             Severity = "medium",
    ///             CveWhitelistItems = 
    ///             {
    ///                 new Tencentcloud.Tcr.Inputs.NamespaceCveWhitelistItemArgs
    ///                 {
    ///                     CveId = "cve-xxxxx",
    ///                 },
    ///             },
    ///         });
    ///         var idTest = Tencentcloud.Tcr.GetNamespaces.Invoke(new Tencentcloud.Tcr.GetNamespacesInvokeArgs
    ///         {
    ///             InstanceId = myNs.InstanceId,
    ///         });
    ///         var nsId = idTest.Apply(idTest =&gt; idTest.NamespaceLists?[0]?.Id);
    ///         var myTrigger = new Tencentcloud.Tcr.WebhookTrigger("myTrigger", new Tencentcloud.Tcr.WebhookTriggerArgs
    ///         {
    ///             RegistryId = mytcrWebhooktrigger.Id,
    ///             Namespace = myNs.Name,
    ///             Trigger = new Tencentcloud.Tcr.Inputs.WebhookTriggerTriggerArgs
    ///             {
    ///                 Name = "trigger-%s",
    ///                 Targets = 
    ///                 {
    ///                     new Tencentcloud.Tcr.Inputs.WebhookTriggerTriggerTargetArgs
    ///                     {
    ///                         Address = "http://example.org/post",
    ///                         Headers = 
    ///                         {
    ///                             new Tencentcloud.Tcr.Inputs.WebhookTriggerTriggerTargetHeaderArgs
    ///                             {
    ///                                 Key = "X-Custom-Header",
    ///                                 Values = 
    ///                                 {
    ///                                     "a",
    ///                                 },
    ///                             },
    ///                         },
    ///                     },
    ///                 },
    ///                 EventTypes = 
    ///                 {
    ///                     "pushImage",
    ///                 },
    ///                 Condition = ".*",
    ///                 Enabled = true,
    ///                 Description = "this is trigger description",
    ///                 NamespaceId = nsId,
    ///             },
    ///             Tags = 
    ///             {
    ///                 { "createdBy", "terraform" },
    ///             },
    ///         });
    ///     }
    /// 
    /// }
    /// ```
    /// 
    /// ## Import
    /// 
    /// tcr webhook_trigger can be imported using the id, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import tencentcloud:Tcr/webhookTrigger:WebhookTrigger webhook_trigger webhook_trigger_id
    /// ```
    /// </summary>
    [TencentcloudResourceType("tencentcloud:Tcr/webhookTrigger:WebhookTrigger")]
    public partial class WebhookTrigger : Pulumi.CustomResource
    {
        /// <summary>
        /// namespace name.
        /// </summary>
        [Output("namespace")]
        public Output<string> Namespace { get; private set; } = null!;

        /// <summary>
        /// instance Id.
        /// </summary>
        [Output("registryId")]
        public Output<string> RegistryId { get; private set; } = null!;

        /// <summary>
        /// Tag description list.
        /// </summary>
        [Output("tags")]
        public Output<ImmutableDictionary<string, object>?> Tags { get; private set; } = null!;

        /// <summary>
        /// trigger parameters.
        /// </summary>
        [Output("trigger")]
        public Output<Outputs.WebhookTriggerTrigger> Trigger { get; private set; } = null!;


        /// <summary>
        /// Create a WebhookTrigger 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 WebhookTrigger(string name, WebhookTriggerArgs args, CustomResourceOptions? options = null)
            : base("tencentcloud:Tcr/webhookTrigger:WebhookTrigger", name, args ?? new WebhookTriggerArgs(), MakeResourceOptions(options, ""))
        {
        }

        private WebhookTrigger(string name, Input<string> id, WebhookTriggerState? state = null, CustomResourceOptions? options = null)
            : base("tencentcloud:Tcr/webhookTrigger:WebhookTrigger", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
                PluginDownloadURL = "github://api.github.com/tencentcloudstack",
            };
            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 WebhookTrigger 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 WebhookTrigger Get(string name, Input<string> id, WebhookTriggerState? state = null, CustomResourceOptions? options = null)
        {
            return new WebhookTrigger(name, id, state, options);
        }
    }

    public sealed class WebhookTriggerArgs : Pulumi.ResourceArgs
    {
        /// <summary>
        /// namespace name.
        /// </summary>
        [Input("namespace", required: true)]
        public Input<string> Namespace { get; set; } = null!;

        /// <summary>
        /// instance Id.
        /// </summary>
        [Input("registryId", required: true)]
        public Input<string> RegistryId { get; set; } = null!;

        [Input("tags")]
        private InputMap<object>? _tags;

        /// <summary>
        /// Tag description list.
        /// </summary>
        public InputMap<object> Tags
        {
            get => _tags ?? (_tags = new InputMap<object>());
            set => _tags = value;
        }

        /// <summary>
        /// trigger parameters.
        /// </summary>
        [Input("trigger", required: true)]
        public Input<Inputs.WebhookTriggerTriggerArgs> Trigger { get; set; } = null!;

        public WebhookTriggerArgs()
        {
        }
    }

    public sealed class WebhookTriggerState : Pulumi.ResourceArgs
    {
        /// <summary>
        /// namespace name.
        /// </summary>
        [Input("namespace")]
        public Input<string>? Namespace { get; set; }

        /// <summary>
        /// instance Id.
        /// </summary>
        [Input("registryId")]
        public Input<string>? RegistryId { get; set; }

        [Input("tags")]
        private InputMap<object>? _tags;

        /// <summary>
        /// Tag description list.
        /// </summary>
        public InputMap<object> Tags
        {
            get => _tags ?? (_tags = new InputMap<object>());
            set => _tags = value;
        }

        /// <summary>
        /// trigger parameters.
        /// </summary>
        [Input("trigger")]
        public Input<Inputs.WebhookTriggerTriggerGetArgs>? Trigger { get; set; }

        public WebhookTriggerState()
        {
        }
    }
}
