<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 TencentCloudIAC.PulumiPackage.Tencentcloud.Security
{
    /// <summary>
    /// Provides a resource to create security group rule. This resource is similar with tencentcloud_security_group_lite_rule, rules can be ordered and configure descriptions.
    /// 
    /// &gt; **NOTE:** This resource must exclusive in one security group, do not declare additional rule resources of this security group elsewhere.
    /// 
    /// ## Example Usage
    /// 
    /// ```csharp
    /// using Pulumi;
    /// using Tencentcloud = TencentCloudIAC.PulumiPackage.Tencentcloud;
    /// 
    /// class MyStack : Stack
    /// {
    ///     public MyStack()
    ///     {
    ///         var sglab1Group = new Tencentcloud.Security.Group("sglab1Group", new Tencentcloud.Security.GroupArgs
    ///         {
    ///             Description = "favourite sg_1",
    ///         });
    ///         var sglab1GroupRuleSet = new Tencentcloud.Security.GroupRuleSet("sglab1GroupRuleSet", new Tencentcloud.Security.GroupRuleSetArgs
    ///         {
    ///             SecurityGroupId = sglab1Group.Id,
    ///             Ingresses = 
    ///             {
    ///                 new Tencentcloud.Security.Inputs.GroupRuleSetIngressArgs
    ///                 {
    ///                     CidrBlock = "10.0.0.0/16",
    ///                     Protocol = "TCP",
    ///                     Port = "80",
    ///                     Action = "ACCEPT",
    ///                     Description = "favourite sg rule_1",
    ///                 },
    ///                 new Tencentcloud.Security.Inputs.GroupRuleSetIngressArgs
    ///                 {
    ///                     Protocol = "TCP",
    ///                     Port = "80",
    ///                     Action = "ACCEPT",
    ///                     SourceSecurityId = tencentcloud_security_group.Sglab_3.Id,
    ///                     Description = "favourite sg rule_2",
    ///                 },
    ///             },
    ///             Egresses = 
    ///             {
    ///                 new Tencentcloud.Security.Inputs.GroupRuleSetEgressArgs
    ///                 {
    ///                     Action = "ACCEPT",
    ///                     AddressTemplateId = "ipm-xxxxxxxx",
    ///                     Description = "Allow address template",
    ///                 },
    ///                 new Tencentcloud.Security.Inputs.GroupRuleSetEgressArgs
    ///                 {
    ///                     Action = "ACCEPT",
    ///                     ServiceTemplateGroup = "ppmg-xxxxxxxx",
    ///                     Description = "Allow protocol template",
    ///                 },
    ///                 new Tencentcloud.Security.Inputs.GroupRuleSetEgressArgs
    ///                 {
    ///                     CidrBlock = "10.0.0.0/16",
    ///                     Protocol = "TCP",
    ///                     Port = "80",
    ///                     Action = "DROP",
    ///                     Description = "favourite sg egress rule",
    ///                 },
    ///             },
    ///         });
    ///     }
    /// 
    /// }
    /// ```
    /// 
    /// ## Import
    /// 
    /// Resource tencentcloud_security_group_rule_set can be imported by passing security grou id
    /// 
    /// ```sh
    ///  $ pulumi import tencentcloud:Security/groupRuleSet:GroupRuleSet sglab_1 sg-xxxxxxxx
    /// ```
    /// </summary>
    [TencentcloudResourceType("tencentcloud:Security/groupRuleSet:GroupRuleSet")]
    public partial class GroupRuleSet : Pulumi.CustomResource
    {
        /// <summary>
        /// List of egress rule. NOTE: this block is ordered, the first rule has the highest priority.
        /// </summary>
        [Output("egresses")]
        public Output<ImmutableArray<Outputs.GroupRuleSetEgress>> Egresses { get; private set; } = null!;

        /// <summary>
        /// List of ingress rule. NOTE: this block is ordered, the first rule has the highest priority.
        /// </summary>
        [Output("ingresses")]
        public Output<ImmutableArray<Outputs.GroupRuleSetIngress>> Ingresses { get; private set; } = null!;

        /// <summary>
        /// ID of the security group to be queried.
        /// </summary>
        [Output("securityGroupId")]
        public Output<string> SecurityGroupId { get; private set; } = null!;

        /// <summary>
        /// Security policies version, auto increment for every update.
        /// </summary>
        [Output("version")]
        public Output<string> Version { get; private set; } = null!;


        /// <summary>
        /// Create a GroupRuleSet 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 GroupRuleSet(string name, GroupRuleSetArgs args, CustomResourceOptions? options = null)
            : base("tencentcloud:Security/groupRuleSet:GroupRuleSet", name, args ?? new GroupRuleSetArgs(), MakeResourceOptions(options, ""))
        {
        }

        private GroupRuleSet(string name, Input<string> id, GroupRuleSetState? state = null, CustomResourceOptions? options = null)
            : base("tencentcloud:Security/groupRuleSet:GroupRuleSet", 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 GroupRuleSet 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 GroupRuleSet Get(string name, Input<string> id, GroupRuleSetState? state = null, CustomResourceOptions? options = null)
        {
            return new GroupRuleSet(name, id, state, options);
        }
    }

    public sealed class GroupRuleSetArgs : Pulumi.ResourceArgs
    {
        [Input("egresses")]
        private InputList<Inputs.GroupRuleSetEgressArgs>? _egresses;

        /// <summary>
        /// List of egress rule. NOTE: this block is ordered, the first rule has the highest priority.
        /// </summary>
        public InputList<Inputs.GroupRuleSetEgressArgs> Egresses
        {
            get => _egresses ?? (_egresses = new InputList<Inputs.GroupRuleSetEgressArgs>());
            set => _egresses = value;
        }

        [Input("ingresses")]
        private InputList<Inputs.GroupRuleSetIngressArgs>? _ingresses;

        /// <summary>
        /// List of ingress rule. NOTE: this block is ordered, the first rule has the highest priority.
        /// </summary>
        public InputList<Inputs.GroupRuleSetIngressArgs> Ingresses
        {
            get => _ingresses ?? (_ingresses = new InputList<Inputs.GroupRuleSetIngressArgs>());
            set => _ingresses = value;
        }

        /// <summary>
        /// ID of the security group to be queried.
        /// </summary>
        [Input("securityGroupId", required: true)]
        public Input<string> SecurityGroupId { get; set; } = null!;

        public GroupRuleSetArgs()
        {
        }
    }

    public sealed class GroupRuleSetState : Pulumi.ResourceArgs
    {
        [Input("egresses")]
        private InputList<Inputs.GroupRuleSetEgressGetArgs>? _egresses;

        /// <summary>
        /// List of egress rule. NOTE: this block is ordered, the first rule has the highest priority.
        /// </summary>
        public InputList<Inputs.GroupRuleSetEgressGetArgs> Egresses
        {
            get => _egresses ?? (_egresses = new InputList<Inputs.GroupRuleSetEgressGetArgs>());
            set => _egresses = value;
        }

        [Input("ingresses")]
        private InputList<Inputs.GroupRuleSetIngressGetArgs>? _ingresses;

        /// <summary>
        /// List of ingress rule. NOTE: this block is ordered, the first rule has the highest priority.
        /// </summary>
        public InputList<Inputs.GroupRuleSetIngressGetArgs> Ingresses
        {
            get => _ingresses ?? (_ingresses = new InputList<Inputs.GroupRuleSetIngressGetArgs>());
            set => _ingresses = value;
        }

        /// <summary>
        /// ID of the security group to be queried.
        /// </summary>
        [Input("securityGroupId")]
        public Input<string>? SecurityGroupId { get; set; }

        /// <summary>
        /// Security policies version, auto increment for every update.
        /// </summary>
        [Input("version")]
        public Input<string>? Version { get; set; }

        public GroupRuleSetState()
        {
        }
    }
}
