// *** 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>
    /// ## # resource codefresh.Permission
    /// 
    /// Permission are used to setup access control and allow to define which teams have access to which clusters and pipelines based on tags
    /// See the [documentation](https://codefresh.io/docs/docs/administration/access-control/).
    /// 
    /// ## Example Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using Codefresh = PiersKarsenbarg.Codefresh;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var developersTeam = new Codefresh.Team("developersTeam", new()
    ///     {
    ///         Users = new[]
    ///         {
    ///             "vqbpgud2ghvjgm1n5hdgjnn5818fzsf2",
    ///             "59009221c102763beda7cf04",
    ///         },
    ///     });
    /// 
    ///     var developersPermission = new Codefresh.Permission("developersPermission", new()
    ///     {
    ///         Team = developersTeam.Id,
    ///         Resource = "pipeline",
    ///         Action = "run",
    ///         Tags = new[]
    ///         {
    ///             "demo",
    ///             "test",
    ///         },
    ///     });
    /// 
    /// });
    /// ```
    /// </summary>
    [CodefreshResourceType("codefresh:index/permission:Permission")]
    public partial class Permission : global::Pulumi.CustomResource
    {
        [Output("_id")]
        public Output<string> _id { get; private set; } = null!;

        /// <summary>
        /// Action to be allowed. Possible values:
        /// - __create__
        /// - __read__
        /// - __update__
        /// - __delete__
        /// - __run__ (Only valid for `pipeline` resource)
        /// - __approve__ (Only valid for `pipeline` resource)
        /// - __debug__ (Only valid for `pipeline` resource)
        /// </summary>
        [Output("action")]
        public Output<string> Action { get; private set; } = null!;

        /// <summary>
        /// The type of resource the permission applies to. Possible values:
        /// - __pipeline__
        /// - __cluster__
        /// </summary>
        [Output("resource")]
        public Output<string> Resource { get; private set; } = null!;

        /// <summary>
        /// The effective tags to apply the permission. It supports 2 custom tags:
        /// - __untagged__ is a “tag” which refers to all clusters that don’t have any tag.
        /// - __*__ (the star character) means all tags.
        /// </summary>
        [Output("tags")]
        public Output<ImmutableArray<string>> Tags { get; private set; } = null!;

        /// <summary>
        /// The Id of the team the permissions apply to.
        /// </summary>
        [Output("team")]
        public Output<string> Team { get; private set; } = null!;


        /// <summary>
        /// Create a Permission 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 Permission(string name, PermissionArgs args, CustomResourceOptions? options = null)
            : base("codefresh:index/permission:Permission", name, args ?? new PermissionArgs(), MakeResourceOptions(options, ""))
        {
        }

        private Permission(string name, Input<string> id, PermissionState? state = null, CustomResourceOptions? options = null)
            : base("codefresh:index/permission:Permission", 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 Permission 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 Permission Get(string name, Input<string> id, PermissionState? state = null, CustomResourceOptions? options = null)
        {
            return new Permission(name, id, state, options);
        }
    }

    public sealed class PermissionArgs : global::Pulumi.ResourceArgs
    {
        [Input("_id")]
        public Input<string>? _id { get; set; }

        /// <summary>
        /// Action to be allowed. Possible values:
        /// - __create__
        /// - __read__
        /// - __update__
        /// - __delete__
        /// - __run__ (Only valid for `pipeline` resource)
        /// - __approve__ (Only valid for `pipeline` resource)
        /// - __debug__ (Only valid for `pipeline` resource)
        /// </summary>
        [Input("action", required: true)]
        public Input<string> Action { get; set; } = null!;

        /// <summary>
        /// The type of resource the permission applies to. Possible values:
        /// - __pipeline__
        /// - __cluster__
        /// </summary>
        [Input("resource", required: true)]
        public Input<string> Resource { get; set; } = null!;

        [Input("tags")]
        private InputList<string>? _tags;

        /// <summary>
        /// The effective tags to apply the permission. It supports 2 custom tags:
        /// - __untagged__ is a “tag” which refers to all clusters that don’t have any tag.
        /// - __*__ (the star character) means all tags.
        /// </summary>
        public InputList<string> Tags
        {
            get => _tags ?? (_tags = new InputList<string>());
            set => _tags = value;
        }

        /// <summary>
        /// The Id of the team the permissions apply to.
        /// </summary>
        [Input("team", required: true)]
        public Input<string> Team { get; set; } = null!;

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

    public sealed class PermissionState : global::Pulumi.ResourceArgs
    {
        [Input("_id")]
        public Input<string>? _id { get; set; }

        /// <summary>
        /// Action to be allowed. Possible values:
        /// - __create__
        /// - __read__
        /// - __update__
        /// - __delete__
        /// - __run__ (Only valid for `pipeline` resource)
        /// - __approve__ (Only valid for `pipeline` resource)
        /// - __debug__ (Only valid for `pipeline` resource)
        /// </summary>
        [Input("action")]
        public Input<string>? Action { get; set; }

        /// <summary>
        /// The type of resource the permission applies to. Possible values:
        /// - __pipeline__
        /// - __cluster__
        /// </summary>
        [Input("resource")]
        public Input<string>? Resource { get; set; }

        [Input("tags")]
        private InputList<string>? _tags;

        /// <summary>
        /// The effective tags to apply the permission. It supports 2 custom tags:
        /// - __untagged__ is a “tag” which refers to all clusters that don’t have any tag.
        /// - __*__ (the star character) means all tags.
        /// </summary>
        public InputList<string> Tags
        {
            get => _tags ?? (_tags = new InputList<string>());
            set => _tags = value;
        }

        /// <summary>
        /// The Id of the team the permissions apply to.
        /// </summary>
        [Input("team")]
        public Input<string>? Team { get; set; }

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