// *** 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.Yandex
{
    public static class GetIamPolicy
    {
        /// <summary>
        /// Generates an [IAM] policy document that may be referenced by and applied to
        /// other Yandex.Cloud Platform resources, such as the `yandex.ResourcemanagerFolder` resource. 
        /// 
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using Yandex = Pulumi.Yandex;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var admin = Yandex.GetIamPolicy.Invoke(new()
        ///     {
        ///         Bindings = new[]
        ///         {
        ///             new Yandex.Inputs.GetIamPolicyBindingInputArgs
        ///             {
        ///                 Members = new[]
        ///                 {
        ///                     "userAccount:user_id_1",
        ///                 },
        ///                 Role = "admin",
        ///             },
        ///             new Yandex.Inputs.GetIamPolicyBindingInputArgs
        ///             {
        ///                 Members = new[]
        ///                 {
        ///                     "userAccount:user_id_2",
        ///                 },
        ///                 Role = "viewer",
        ///             },
        ///         },
        ///     });
        /// 
        /// });
        /// ```
        /// 
        /// This data source is used to define [IAM] policies to apply to other resources.
        /// Currently, defining a policy through a data source and referencing that policy
        /// from another resource is the only way to apply an IAM policy to a resource.
        /// </summary>
        public static Task<GetIamPolicyResult> InvokeAsync(GetIamPolicyArgs args, InvokeOptions? options = null)
            => global::Pulumi.Deployment.Instance.InvokeAsync<GetIamPolicyResult>("yandex:index/getIamPolicy:getIamPolicy", args ?? new GetIamPolicyArgs(), options.WithDefaults());

        /// <summary>
        /// Generates an [IAM] policy document that may be referenced by and applied to
        /// other Yandex.Cloud Platform resources, such as the `yandex.ResourcemanagerFolder` resource. 
        /// 
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using Yandex = Pulumi.Yandex;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var admin = Yandex.GetIamPolicy.Invoke(new()
        ///     {
        ///         Bindings = new[]
        ///         {
        ///             new Yandex.Inputs.GetIamPolicyBindingInputArgs
        ///             {
        ///                 Members = new[]
        ///                 {
        ///                     "userAccount:user_id_1",
        ///                 },
        ///                 Role = "admin",
        ///             },
        ///             new Yandex.Inputs.GetIamPolicyBindingInputArgs
        ///             {
        ///                 Members = new[]
        ///                 {
        ///                     "userAccount:user_id_2",
        ///                 },
        ///                 Role = "viewer",
        ///             },
        ///         },
        ///     });
        /// 
        /// });
        /// ```
        /// 
        /// This data source is used to define [IAM] policies to apply to other resources.
        /// Currently, defining a policy through a data source and referencing that policy
        /// from another resource is the only way to apply an IAM policy to a resource.
        /// </summary>
        public static Output<GetIamPolicyResult> Invoke(GetIamPolicyInvokeArgs args, InvokeOptions? options = null)
            => global::Pulumi.Deployment.Instance.Invoke<GetIamPolicyResult>("yandex:index/getIamPolicy:getIamPolicy", args ?? new GetIamPolicyInvokeArgs(), options.WithDefaults());
    }


    public sealed class GetIamPolicyArgs : global::Pulumi.InvokeArgs
    {
        [Input("bindings", required: true)]
        private List<Inputs.GetIamPolicyBindingArgs>? _bindings;

        /// <summary>
        /// A nested configuration block (described below)
        /// that defines a binding to be included in the policy document. Multiple
        /// `binding` arguments are supported.
        /// </summary>
        public List<Inputs.GetIamPolicyBindingArgs> Bindings
        {
            get => _bindings ?? (_bindings = new List<Inputs.GetIamPolicyBindingArgs>());
            set => _bindings = value;
        }

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

    public sealed class GetIamPolicyInvokeArgs : global::Pulumi.InvokeArgs
    {
        [Input("bindings", required: true)]
        private InputList<Inputs.GetIamPolicyBindingInputArgs>? _bindings;

        /// <summary>
        /// A nested configuration block (described below)
        /// that defines a binding to be included in the policy document. Multiple
        /// `binding` arguments are supported.
        /// </summary>
        public InputList<Inputs.GetIamPolicyBindingInputArgs> Bindings
        {
            get => _bindings ?? (_bindings = new InputList<Inputs.GetIamPolicyBindingInputArgs>());
            set => _bindings = value;
        }

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


    [OutputType]
    public sealed class GetIamPolicyResult
    {
        public readonly ImmutableArray<Outputs.GetIamPolicyBindingResult> Bindings;
        /// <summary>
        /// The provider-assigned unique ID for this managed resource.
        /// </summary>
        public readonly string Id;
        /// <summary>
        /// The above bindings serialized in a format suitable for
        /// referencing from a resource that supports IAM.
        /// </summary>
        public readonly string PolicyData;

        [OutputConstructor]
        private GetIamPolicyResult(
            ImmutableArray<Outputs.GetIamPolicyBindingResult> bindings,

            string id,

            string policyData)
        {
            Bindings = bindings;
            Id = id;
            PolicyData = policyData;
        }
    }
}
