<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;

namespace Pulumi.Elasticstack
{
    /// <summary>
    /// Adds and updates roles in the native realm. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html
    /// 
    /// ## Example Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using System.Text.Json;
    /// using Pulumi;
    /// using Elasticstack = Pulumi.Elasticstack;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var roleSecurityRole = new Elasticstack.SecurityRole("roleSecurityRole", new()
    ///     {
    ///         Clusters = new[]
    ///         {
    ///             "all",
    ///         },
    ///         Indices = new[]
    ///         {
    ///             new Elasticstack.Inputs.SecurityRoleIndexArgs
    ///             {
    ///                 Names = new[]
    ///                 {
    ///                     "index1",
    ///                     "index2",
    ///                 },
    ///                 Privileges = new[]
    ///                 {
    ///                     "all",
    ///                 },
    ///             },
    ///         },
    ///         Applications = new[]
    ///         {
    ///             new Elasticstack.Inputs.SecurityRoleApplicationArgs
    ///             {
    ///                 Application = "myapp",
    ///                 Privileges = new[]
    ///                 {
    ///                     "admin",
    ///                     "read",
    ///                 },
    ///                 Resources = new[]
    ///                 {
    ///                     "*",
    ///                 },
    ///             },
    ///         },
    ///         RunAs = new[]
    ///         {
    ///             "other_user",
    ///         },
    ///         Metadata = JsonSerializer.Serialize(new Dictionary&lt;string, object?&gt;
    ///         {
    ///             ["version"] = 1,
    ///         }),
    ///     });
    /// 
    ///     return new Dictionary&lt;string, object?&gt;
    ///     {
    ///         ["role"] = roleSecurityRole,
    ///     };
    /// });
    /// ```
    /// 
    /// ## Import
    /// 
    /// ```sh
    ///  $ pulumi import elasticstack:index/securityRole:SecurityRole my_role &lt;cluster_uuid&gt;/&lt;role name&gt;
    /// ```
    /// </summary>
    [ElasticstackResourceType("elasticstack:index/securityRole:SecurityRole")]
    public partial class SecurityRole : global::Pulumi.CustomResource
    {
        /// <summary>
        /// A list of application privilege entries.
        /// </summary>
        [Output("applications")]
        public Output<ImmutableArray<Outputs.SecurityRoleApplication>> Applications { get; private set; } = null!;

        /// <summary>
        /// A list of cluster privileges. These privileges define the cluster level actions that users with this role are able to execute.
        /// </summary>
        [Output("clusters")]
        public Output<ImmutableArray<string>> Clusters { get; private set; } = null!;

        /// <summary>
        /// Elasticsearch connection configuration block.
        /// </summary>
        [Output("elasticsearchConnection")]
        public Output<Outputs.SecurityRoleElasticsearchConnection?> ElasticsearchConnection { get; private set; } = null!;

        /// <summary>
        /// An object defining global privileges.
        /// </summary>
        [Output("global")]
        public Output<string?> Global { get; private set; } = null!;

        /// <summary>
        /// A list of indices permissions entries.
        /// </summary>
        [Output("indices")]
        public Output<ImmutableArray<Outputs.SecurityRoleIndex>> Indices { get; private set; } = null!;

        /// <summary>
        /// Optional meta-data.
        /// </summary>
        [Output("metadata")]
        public Output<string> Metadata { get; private set; } = null!;

        /// <summary>
        /// The name of the role.
        /// </summary>
        [Output("name")]
        public Output<string> Name { get; private set; } = null!;

        /// <summary>
        /// A list of users that the owners of this role can impersonate.
        /// </summary>
        [Output("runAs")]
        public Output<ImmutableArray<string>> RunAs { get; private set; } = null!;


        /// <summary>
        /// Create a SecurityRole 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 SecurityRole(string name, SecurityRoleArgs? args = null, CustomResourceOptions? options = null)
            : base("elasticstack:index/securityRole:SecurityRole", name, args ?? new SecurityRoleArgs(), MakeResourceOptions(options, ""))
        {
        }

        private SecurityRole(string name, Input<string> id, SecurityRoleState? state = null, CustomResourceOptions? options = null)
            : base("elasticstack:index/securityRole:SecurityRole", 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/zlepper",
            };
            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 SecurityRole 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 SecurityRole Get(string name, Input<string> id, SecurityRoleState? state = null, CustomResourceOptions? options = null)
        {
            return new SecurityRole(name, id, state, options);
        }
    }

    public sealed class SecurityRoleArgs : global::Pulumi.ResourceArgs
    {
        [Input("applications")]
        private InputList<Inputs.SecurityRoleApplicationArgs>? _applications;

        /// <summary>
        /// A list of application privilege entries.
        /// </summary>
        public InputList<Inputs.SecurityRoleApplicationArgs> Applications
        {
            get => _applications ?? (_applications = new InputList<Inputs.SecurityRoleApplicationArgs>());
            set => _applications = value;
        }

        [Input("clusters")]
        private InputList<string>? _clusters;

        /// <summary>
        /// A list of cluster privileges. These privileges define the cluster level actions that users with this role are able to execute.
        /// </summary>
        public InputList<string> Clusters
        {
            get => _clusters ?? (_clusters = new InputList<string>());
            set => _clusters = value;
        }

        /// <summary>
        /// Elasticsearch connection configuration block.
        /// </summary>
        [Input("elasticsearchConnection")]
        public Input<Inputs.SecurityRoleElasticsearchConnectionArgs>? ElasticsearchConnection { get; set; }

        /// <summary>
        /// An object defining global privileges.
        /// </summary>
        [Input("global")]
        public Input<string>? Global { get; set; }

        [Input("indices")]
        private InputList<Inputs.SecurityRoleIndexArgs>? _indices;

        /// <summary>
        /// A list of indices permissions entries.
        /// </summary>
        public InputList<Inputs.SecurityRoleIndexArgs> Indices
        {
            get => _indices ?? (_indices = new InputList<Inputs.SecurityRoleIndexArgs>());
            set => _indices = value;
        }

        /// <summary>
        /// Optional meta-data.
        /// </summary>
        [Input("metadata")]
        public Input<string>? Metadata { get; set; }

        /// <summary>
        /// The name of the role.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        [Input("runAs")]
        private InputList<string>? _runAs;

        /// <summary>
        /// A list of users that the owners of this role can impersonate.
        /// </summary>
        public InputList<string> RunAs
        {
            get => _runAs ?? (_runAs = new InputList<string>());
            set => _runAs = value;
        }

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

    public sealed class SecurityRoleState : global::Pulumi.ResourceArgs
    {
        [Input("applications")]
        private InputList<Inputs.SecurityRoleApplicationGetArgs>? _applications;

        /// <summary>
        /// A list of application privilege entries.
        /// </summary>
        public InputList<Inputs.SecurityRoleApplicationGetArgs> Applications
        {
            get => _applications ?? (_applications = new InputList<Inputs.SecurityRoleApplicationGetArgs>());
            set => _applications = value;
        }

        [Input("clusters")]
        private InputList<string>? _clusters;

        /// <summary>
        /// A list of cluster privileges. These privileges define the cluster level actions that users with this role are able to execute.
        /// </summary>
        public InputList<string> Clusters
        {
            get => _clusters ?? (_clusters = new InputList<string>());
            set => _clusters = value;
        }

        /// <summary>
        /// Elasticsearch connection configuration block.
        /// </summary>
        [Input("elasticsearchConnection")]
        public Input<Inputs.SecurityRoleElasticsearchConnectionGetArgs>? ElasticsearchConnection { get; set; }

        /// <summary>
        /// An object defining global privileges.
        /// </summary>
        [Input("global")]
        public Input<string>? Global { get; set; }

        [Input("indices")]
        private InputList<Inputs.SecurityRoleIndexGetArgs>? _indices;

        /// <summary>
        /// A list of indices permissions entries.
        /// </summary>
        public InputList<Inputs.SecurityRoleIndexGetArgs> Indices
        {
            get => _indices ?? (_indices = new InputList<Inputs.SecurityRoleIndexGetArgs>());
            set => _indices = value;
        }

        /// <summary>
        /// Optional meta-data.
        /// </summary>
        [Input("metadata")]
        public Input<string>? Metadata { get; set; }

        /// <summary>
        /// The name of the role.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        [Input("runAs")]
        private InputList<string>? _runAs;

        /// <summary>
        /// A list of users that the owners of this role can impersonate.
        /// </summary>
        public InputList<string> RunAs
        {
            get => _runAs ?? (_runAs = new InputList<string>());
            set => _runAs = value;
        }

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