1. Packages
  2. AWS Native
  3. API Docs
  4. iam
  5. getUserPolicy

We recommend new projects start with resources from the AWS provider.

AWS Native v0.126.0 published on Monday, Sep 30, 2024 by Pulumi

aws-native.iam.getUserPolicy

Explore with Pulumi AI

aws-native logo

We recommend new projects start with resources from the AWS provider.

AWS Native v0.126.0 published on Monday, Sep 30, 2024 by Pulumi

    Adds or updates an inline policy document that is embedded in the specified IAM user. An IAM user can also have a managed policy attached to it. To attach a managed policy to a user, use AWS::IAM::User. To create a new managed policy, use AWS::IAM::ManagedPolicy. For information about policies, see Managed policies and inline policies in the IAM User Guide. For information about the maximum number of inline policies that you can embed in a user, see IAM and quotas in the IAM User Guide.

    Using getUserPolicy

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getUserPolicy(args: GetUserPolicyArgs, opts?: InvokeOptions): Promise<GetUserPolicyResult>
    function getUserPolicyOutput(args: GetUserPolicyOutputArgs, opts?: InvokeOptions): Output<GetUserPolicyResult>
    def get_user_policy(policy_name: Optional[str] = None,
                        user_name: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetUserPolicyResult
    def get_user_policy_output(policy_name: Optional[pulumi.Input[str]] = None,
                        user_name: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetUserPolicyResult]
    func LookupUserPolicy(ctx *Context, args *LookupUserPolicyArgs, opts ...InvokeOption) (*LookupUserPolicyResult, error)
    func LookupUserPolicyOutput(ctx *Context, args *LookupUserPolicyOutputArgs, opts ...InvokeOption) LookupUserPolicyResultOutput

    > Note: This function is named LookupUserPolicy in the Go SDK.

    public static class GetUserPolicy 
    {
        public static Task<GetUserPolicyResult> InvokeAsync(GetUserPolicyArgs args, InvokeOptions? opts = null)
        public static Output<GetUserPolicyResult> Invoke(GetUserPolicyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetUserPolicyResult> getUserPolicy(GetUserPolicyArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws-native:iam:getUserPolicy
      arguments:
        # arguments dictionary

    The following arguments are supported:

    PolicyName string
    The name of the policy document. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
    UserName string
    The name of the user to associate the policy with. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
    PolicyName string
    The name of the policy document. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
    UserName string
    The name of the user to associate the policy with. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
    policyName String
    The name of the policy document. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
    userName String
    The name of the user to associate the policy with. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
    policyName string
    The name of the policy document. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
    userName string
    The name of the user to associate the policy with. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
    policy_name str
    The name of the policy document. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
    user_name str
    The name of the user to associate the policy with. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
    policyName String
    The name of the policy document. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
    userName String
    The name of the user to associate the policy with. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

    getUserPolicy Result

    The following output properties are available:

    PolicyDocument object

    The policy document. You must provide policies in JSON format in IAM. However, for CFN templates formatted in YAML, you can provide the policy in JSON or YAML format. CFN always converts a YAML policy to JSON format before submitting it to IAM. The regex pattern used to validate this parameter is a string of characters consisting of the following:

    • Any printable ASCII character ranging from the space character (\u0020) through the end of the ASCII character range
    • The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
    • The special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D)

    Search the CloudFormation User Guide for AWS::IAM::UserPolicy for more information about the expected schema for this property.

    PolicyDocument interface{}

    The policy document. You must provide policies in JSON format in IAM. However, for CFN templates formatted in YAML, you can provide the policy in JSON or YAML format. CFN always converts a YAML policy to JSON format before submitting it to IAM. The regex pattern used to validate this parameter is a string of characters consisting of the following:

    • Any printable ASCII character ranging from the space character (\u0020) through the end of the ASCII character range
    • The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
    • The special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D)

    Search the CloudFormation User Guide for AWS::IAM::UserPolicy for more information about the expected schema for this property.

    policyDocument Object

    The policy document. You must provide policies in JSON format in IAM. However, for CFN templates formatted in YAML, you can provide the policy in JSON or YAML format. CFN always converts a YAML policy to JSON format before submitting it to IAM. The regex pattern used to validate this parameter is a string of characters consisting of the following:

    • Any printable ASCII character ranging from the space character (\u0020) through the end of the ASCII character range
    • The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
    • The special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D)

    Search the CloudFormation User Guide for AWS::IAM::UserPolicy for more information about the expected schema for this property.

    policyDocument any

    The policy document. You must provide policies in JSON format in IAM. However, for CFN templates formatted in YAML, you can provide the policy in JSON or YAML format. CFN always converts a YAML policy to JSON format before submitting it to IAM. The regex pattern used to validate this parameter is a string of characters consisting of the following:

    • Any printable ASCII character ranging from the space character (\u0020) through the end of the ASCII character range
    • The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
    • The special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D)

    Search the CloudFormation User Guide for AWS::IAM::UserPolicy for more information about the expected schema for this property.

    policy_document Any

    The policy document. You must provide policies in JSON format in IAM. However, for CFN templates formatted in YAML, you can provide the policy in JSON or YAML format. CFN always converts a YAML policy to JSON format before submitting it to IAM. The regex pattern used to validate this parameter is a string of characters consisting of the following:

    • Any printable ASCII character ranging from the space character (\u0020) through the end of the ASCII character range
    • The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
    • The special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D)

    Search the CloudFormation User Guide for AWS::IAM::UserPolicy for more information about the expected schema for this property.

    policyDocument Any

    The policy document. You must provide policies in JSON format in IAM. However, for CFN templates formatted in YAML, you can provide the policy in JSON or YAML format. CFN always converts a YAML policy to JSON format before submitting it to IAM. The regex pattern used to validate this parameter is a string of characters consisting of the following:

    • Any printable ASCII character ranging from the space character (\u0020) through the end of the ASCII character range
    • The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
    • The special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D)

    Search the CloudFormation User Guide for AWS::IAM::UserPolicy for more information about the expected schema for this property.

    Package Details

    Repository
    AWS Native pulumi/pulumi-aws-native
    License
    Apache-2.0
    aws-native logo

    We recommend new projects start with resources from the AWS provider.

    AWS Native v0.126.0 published on Monday, Sep 30, 2024 by Pulumi