<filename>sdk/dotnet/ResourceManager/PolicyAttachment.cs// *** 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.AliCloud.ResourceManager
{
    /// <summary>
    /// Provides a Resource Manager Policy Attachment resource to attaches a policy to an object. After you attach a policy to an object, the object has the operation permissions on the current resource group or the resources under the current account.
    /// For information about Resource Manager Policy Attachment and how to use it, see [How to authorize and manage resource groups](https://www.alibabacloud.com/help/en/doc-detail/94490.htm).
    /// 
    /// &gt; **NOTE:** Available in v1.93.0+.
    /// 
    /// ## Import
    /// 
    /// Resource Manager Policy Attachment can be imported using the id, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import alicloud:resourcemanager/policyAttachment:PolicyAttachment example tf-testaccrdpolicy:Custom:efpyi@example.com:IMSUser:rg******
    /// ```
    /// </summary>
    [AliCloudResourceType("alicloud:resourcemanager/policyAttachment:PolicyAttachment")]
    public partial class PolicyAttachment : global::Pulumi.CustomResource
    {
        /// <summary>
        /// The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
        /// </summary>
        [Output("policyName")]
        public Output<string> PolicyName { get; private set; } = null!;

        /// <summary>
        /// - (Required, ForceNew) The type of the policy. Valid values: `Custom`, `System`.
        /// </summary>
        [Output("policyType")]
        public Output<string> PolicyType { get; private set; } = null!;

        /// <summary>
        /// The name of the object to which you want to attach the policy.
        /// </summary>
        [Output("principalName")]
        public Output<string> PrincipalName { get; private set; } = null!;

        /// <summary>
        /// The type of the object to which you want to attach the policy. Valid values: `IMSUser`: RAM user, `IMSGroup`: RAM user group, `ServiceRole`: RAM role.
        /// </summary>
        [Output("principalType")]
        public Output<string> PrincipalType { get; private set; } = null!;

        /// <summary>
        /// The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
        /// </summary>
        [Output("resourceGroupId")]
        public Output<string> ResourceGroupId { get; private set; } = null!;


        /// <summary>
        /// Create a PolicyAttachment 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 PolicyAttachment(string name, PolicyAttachmentArgs args, CustomResourceOptions? options = null)
            : base("alicloud:resourcemanager/policyAttachment:PolicyAttachment", name, args ?? new PolicyAttachmentArgs(), MakeResourceOptions(options, ""))
        {
        }

        private PolicyAttachment(string name, Input<string> id, PolicyAttachmentState? state = null, CustomResourceOptions? options = null)
            : base("alicloud:resourcemanager/policyAttachment:PolicyAttachment", 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/rhysmdnz/pulumi-alicloud",
            };
            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 PolicyAttachment 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 PolicyAttachment Get(string name, Input<string> id, PolicyAttachmentState? state = null, CustomResourceOptions? options = null)
        {
            return new PolicyAttachment(name, id, state, options);
        }
    }

    public sealed class PolicyAttachmentArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
        /// </summary>
        [Input("policyName", required: true)]
        public Input<string> PolicyName { get; set; } = null!;

        /// <summary>
        /// - (Required, ForceNew) The type of the policy. Valid values: `Custom`, `System`.
        /// </summary>
        [Input("policyType", required: true)]
        public Input<string> PolicyType { get; set; } = null!;

        /// <summary>
        /// The name of the object to which you want to attach the policy.
        /// </summary>
        [Input("principalName", required: true)]
        public Input<string> PrincipalName { get; set; } = null!;

        /// <summary>
        /// The type of the object to which you want to attach the policy. Valid values: `IMSUser`: RAM user, `IMSGroup`: RAM user group, `ServiceRole`: RAM role.
        /// </summary>
        [Input("principalType", required: true)]
        public Input<string> PrincipalType { get; set; } = null!;

        /// <summary>
        /// The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
        /// </summary>
        [Input("resourceGroupId", required: true)]
        public Input<string> ResourceGroupId { get; set; } = null!;

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

    public sealed class PolicyAttachmentState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The name of the policy. name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
        /// </summary>
        [Input("policyName")]
        public Input<string>? PolicyName { get; set; }

        /// <summary>
        /// - (Required, ForceNew) The type of the policy. Valid values: `Custom`, `System`.
        /// </summary>
        [Input("policyType")]
        public Input<string>? PolicyType { get; set; }

        /// <summary>
        /// The name of the object to which you want to attach the policy.
        /// </summary>
        [Input("principalName")]
        public Input<string>? PrincipalName { get; set; }

        /// <summary>
        /// The type of the object to which you want to attach the policy. Valid values: `IMSUser`: RAM user, `IMSGroup`: RAM user group, `ServiceRole`: RAM role.
        /// </summary>
        [Input("principalType")]
        public Input<string>? PrincipalType { get; set; }

        /// <summary>
        /// The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
        /// </summary>
        [Input("resourceGroupId")]
        public Input<string>? ResourceGroupId { get; set; }

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