// *** 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
{
    public static class GetSecurityRole
    {
        /// <summary>
        /// Use this data source to get information about an existing Elasticsearch role. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using Elasticstack = Pulumi.Elasticstack;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var roleSecurityRole = Elasticstack.GetSecurityRole.Invoke(new()
        ///     {
        ///         Name = "testrole",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["role"] = roleSecurityRole.Apply(getSecurityRoleResult =&gt; getSecurityRoleResult.Name),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Task<GetSecurityRoleResult> InvokeAsync(GetSecurityRoleArgs args, InvokeOptions? options = null)
            => global::Pulumi.Deployment.Instance.InvokeAsync<GetSecurityRoleResult>("elasticstack:index/getSecurityRole:getSecurityRole", args ?? new GetSecurityRoleArgs(), options.WithDefaults());

        /// <summary>
        /// Use this data source to get information about an existing Elasticsearch role. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using Elasticstack = Pulumi.Elasticstack;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var roleSecurityRole = Elasticstack.GetSecurityRole.Invoke(new()
        ///     {
        ///         Name = "testrole",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["role"] = roleSecurityRole.Apply(getSecurityRoleResult =&gt; getSecurityRoleResult.Name),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Output<GetSecurityRoleResult> Invoke(GetSecurityRoleInvokeArgs args, InvokeOptions? options = null)
            => global::Pulumi.Deployment.Instance.Invoke<GetSecurityRoleResult>("elasticstack:index/getSecurityRole:getSecurityRole", args ?? new GetSecurityRoleInvokeArgs(), options.WithDefaults());
    }


    public sealed class GetSecurityRoleArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// Elasticsearch connection configuration block.
        /// </summary>
        [Input("elasticsearchConnection")]
        public Inputs.GetSecurityRoleElasticsearchConnectionArgs? ElasticsearchConnection { get; set; }

        /// <summary>
        /// The name of the role.
        /// </summary>
        [Input("name", required: true)]
        public string Name { get; set; } = null!;

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

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

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

    public sealed class GetSecurityRoleInvokeArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// Elasticsearch connection configuration block.
        /// </summary>
        [Input("elasticsearchConnection")]
        public Input<Inputs.GetSecurityRoleElasticsearchConnectionInputArgs>? ElasticsearchConnection { get; set; }

        /// <summary>
        /// The name of the role.
        /// </summary>
        [Input("name", required: true)]
        public Input<string> Name { get; set; } = null!;

        [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 GetSecurityRoleInvokeArgs()
        {
        }
        public static new GetSecurityRoleInvokeArgs Empty => new GetSecurityRoleInvokeArgs();
    }


    [OutputType]
    public sealed class GetSecurityRoleResult
    {
        /// <summary>
        /// A list of application privilege entries.
        /// </summary>
        public readonly ImmutableArray<Outputs.GetSecurityRoleApplicationResult> Applications;
        /// <summary>
        /// A list of cluster privileges. These privileges define the cluster level actions that users with this role are able to execute.
        /// </summary>
        public readonly ImmutableArray<string> Clusters;
        /// <summary>
        /// Elasticsearch connection configuration block.
        /// </summary>
        public readonly Outputs.GetSecurityRoleElasticsearchConnectionResult? ElasticsearchConnection;
        /// <summary>
        /// An object defining global privileges.
        /// </summary>
        public readonly string Global;
        /// <summary>
        /// Internal identifier of the resource
        /// </summary>
        public readonly string Id;
        /// <summary>
        /// A list of indices permissions entries.
        /// </summary>
        public readonly ImmutableArray<Outputs.GetSecurityRoleIndexResult> Indices;
        /// <summary>
        /// Optional meta-data.
        /// </summary>
        public readonly string Metadata;
        /// <summary>
        /// The name of the role.
        /// </summary>
        public readonly string Name;
        /// <summary>
        /// A list of users that the owners of this role can impersonate.
        /// </summary>
        public readonly ImmutableArray<string> RunAs;

        [OutputConstructor]
        private GetSecurityRoleResult(
            ImmutableArray<Outputs.GetSecurityRoleApplicationResult> applications,

            ImmutableArray<string> clusters,

            Outputs.GetSecurityRoleElasticsearchConnectionResult? elasticsearchConnection,

            string global,

            string id,

            ImmutableArray<Outputs.GetSecurityRoleIndexResult> indices,

            string metadata,

            string name,

            ImmutableArray<string> runAs)
        {
            Applications = applications;
            Clusters = clusters;
            ElasticsearchConnection = elasticsearchConnection;
            Global = global;
            Id = id;
            Indices = indices;
            Metadata = metadata;
            Name = name;
            RunAs = runAs;
        }
    }
}
