1. Packages
  2. MinIO
  3. API Docs
  4. getIamPolicyDocument
MinIO v0.15.1 published on Friday, Dec 15, 2023 by Pulumi

minio.getIamPolicyDocument

Explore with Pulumi AI

minio logo
MinIO v0.15.1 published on Friday, Dec 15, 2023 by Pulumi

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Minio = Pulumi.Minio;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Minio.GetIamPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Minio.Inputs.GetIamPolicyDocumentStatementInputArgs
                {
                    Sid = "1",
                    Actions = new[]
                    {
                        "s3:ListAllMyBuckets",
                        "s3:GetBucketLocation",
                    },
                    Resources = new[]
                    {
                        "arn:aws:s3:::*",
                    },
                },
                new Minio.Inputs.GetIamPolicyDocumentStatementInputArgs
                {
                    Actions = new[]
                    {
                        "s3:ListBucket",
                    },
                    Resources = new[]
                    {
                        "arn:aws:s3:::state-terraform-s3",
                    },
                    Conditions = new[]
                    {
                        new Minio.Inputs.GetIamPolicyDocumentStatementConditionInputArgs
                        {
                            Test = "StringLike",
                            Variable = "s3:prefix",
                            Values = new[]
                            {
                                "",
                                "home/",
                            },
                        },
                    },
                },
                new Minio.Inputs.GetIamPolicyDocumentStatementInputArgs
                {
                    Actions = new[]
                    {
                        "s3:PutObject",
                    },
                    Resources = new[]
                    {
                        "arn:aws:s3:::state-terraform-s3",
                        "arn:aws:s3:::state-terraform-s3/*",
                    },
                },
            },
        });
    
        var testPolicy = new Minio.IamPolicy("testPolicy", new()
        {
            Policy = example.Apply(getIamPolicyDocumentResult => getIamPolicyDocumentResult.Json),
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-minio/sdk/go/minio"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := minio.GetIamPolicyDocument(ctx, &minio.GetIamPolicyDocumentArgs{
    			Statements: pulumi.Array{
    				minio.GetIamPolicyDocumentStatement{
    					Sid: pulumi.StringRef("1"),
    					Actions: []string{
    						"s3:ListAllMyBuckets",
    						"s3:GetBucketLocation",
    					},
    					Resources: []string{
    						"arn:aws:s3:::*",
    					},
    				},
    				minio.GetIamPolicyDocumentStatement{
    					Actions: []string{
    						"s3:ListBucket",
    					},
    					Resources: []string{
    						"arn:aws:s3:::state-terraform-s3",
    					},
    					Conditions: []minio.GetIamPolicyDocumentStatementCondition{
    						{
    							Test:     "StringLike",
    							Variable: "s3:prefix",
    							Values: []string{
    								"",
    								"home/",
    							},
    						},
    					},
    				},
    				minio.GetIamPolicyDocumentStatement{
    					Actions: []string{
    						"s3:PutObject",
    					},
    					Resources: []string{
    						"arn:aws:s3:::state-terraform-s3",
    						"arn:aws:s3:::state-terraform-s3/*",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = minio.NewIamPolicy(ctx, "testPolicy", &minio.IamPolicyArgs{
    			Policy: *pulumi.String(example.Json),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.minio.MinioFunctions;
    import com.pulumi.minio.inputs.GetIamPolicyDocumentArgs;
    import com.pulumi.minio.IamPolicy;
    import com.pulumi.minio.IamPolicyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var example = MinioFunctions.getIamPolicyDocument(GetIamPolicyDocumentArgs.builder()
                .statements(            
                    GetIamPolicyDocumentStatementArgs.builder()
                        .sid("1")
                        .actions(                    
                            "s3:ListAllMyBuckets",
                            "s3:GetBucketLocation")
                        .resources("arn:aws:s3:::*")
                        .build(),
                    GetIamPolicyDocumentStatementArgs.builder()
                        .actions("s3:ListBucket")
                        .resources("arn:aws:s3:::state-terraform-s3")
                        .conditions(GetIamPolicyDocumentStatementConditionArgs.builder()
                            .test("StringLike")
                            .variable("s3:prefix")
                            .values(                        
                                "",
                                "home/")
                            .build())
                        .build(),
                    GetIamPolicyDocumentStatementArgs.builder()
                        .actions("s3:PutObject")
                        .resources(                    
                            "arn:aws:s3:::state-terraform-s3",
                            "arn:aws:s3:::state-terraform-s3/*")
                        .build())
                .build());
    
            var testPolicy = new IamPolicy("testPolicy", IamPolicyArgs.builder()        
                .policy(example.applyValue(getIamPolicyDocumentResult -> getIamPolicyDocumentResult.json()))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_minio as minio
    
    example = minio.get_iam_policy_document(statements=[
        minio.GetIamPolicyDocumentStatementArgs(
            sid="1",
            actions=[
                "s3:ListAllMyBuckets",
                "s3:GetBucketLocation",
            ],
            resources=["arn:aws:s3:::*"],
        ),
        minio.GetIamPolicyDocumentStatementArgs(
            actions=["s3:ListBucket"],
            resources=["arn:aws:s3:::state-terraform-s3"],
            conditions=[minio.GetIamPolicyDocumentStatementConditionArgs(
                test="StringLike",
                variable="s3:prefix",
                values=[
                    "",
                    "home/",
                ],
            )],
        ),
        minio.GetIamPolicyDocumentStatementArgs(
            actions=["s3:PutObject"],
            resources=[
                "arn:aws:s3:::state-terraform-s3",
                "arn:aws:s3:::state-terraform-s3/*",
            ],
        ),
    ])
    test_policy = minio.IamPolicy("testPolicy", policy=example.json)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as minio from "@pulumi/minio";
    
    const example = minio.getIamPolicyDocument({
        statements: [
            {
                sid: "1",
                actions: [
                    "s3:ListAllMyBuckets",
                    "s3:GetBucketLocation",
                ],
                resources: ["arn:aws:s3:::*"],
            },
            {
                actions: ["s3:ListBucket"],
                resources: ["arn:aws:s3:::state-terraform-s3"],
                conditions: [{
                    test: "StringLike",
                    variable: "s3:prefix",
                    values: [
                        "",
                        "home/",
                    ],
                }],
            },
            {
                actions: ["s3:PutObject"],
                resources: [
                    "arn:aws:s3:::state-terraform-s3",
                    "arn:aws:s3:::state-terraform-s3/*",
                ],
            },
        ],
    });
    const testPolicy = new minio.IamPolicy("testPolicy", {policy: example.then(example => example.json)});
    
    resources:
      testPolicy:
        type: minio:IamPolicy
        properties:
          policy: ${example.json}
    variables:
      example:
        fn::invoke:
          Function: minio:getIamPolicyDocument
          Arguments:
            statements:
              - sid: '1'
                actions:
                  - s3:ListAllMyBuckets
                  - s3:GetBucketLocation
                resources:
                  - arn:aws:s3:::*
              - actions:
                  - s3:ListBucket
                resources:
                  - arn:aws:s3:::state-terraform-s3
                conditions:
                  - test: StringLike
                    variable: s3:prefix
                    values:
                      -
                      - home/
              - actions:
                  - s3:PutObject
                resources:
                  - arn:aws:s3:::state-terraform-s3
                  - arn:aws:s3:::state-terraform-s3/*
    

    Using getIamPolicyDocument

    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 getIamPolicyDocument(args: GetIamPolicyDocumentArgs, opts?: InvokeOptions): Promise<GetIamPolicyDocumentResult>
    function getIamPolicyDocumentOutput(args: GetIamPolicyDocumentOutputArgs, opts?: InvokeOptions): Output<GetIamPolicyDocumentResult>
    def get_iam_policy_document(override_json: Optional[str] = None,
                                policy_id: Optional[str] = None,
                                source_json: Optional[str] = None,
                                statements: Optional[Sequence[GetIamPolicyDocumentStatement]] = None,
                                version: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetIamPolicyDocumentResult
    def get_iam_policy_document_output(override_json: Optional[pulumi.Input[str]] = None,
                                policy_id: Optional[pulumi.Input[str]] = None,
                                source_json: Optional[pulumi.Input[str]] = None,
                                statements: Optional[pulumi.Input[Sequence[pulumi.Input[GetIamPolicyDocumentStatementArgs]]]] = None,
                                version: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetIamPolicyDocumentResult]
    func GetIamPolicyDocument(ctx *Context, args *GetIamPolicyDocumentArgs, opts ...InvokeOption) (*GetIamPolicyDocumentResult, error)
    func GetIamPolicyDocumentOutput(ctx *Context, args *GetIamPolicyDocumentOutputArgs, opts ...InvokeOption) GetIamPolicyDocumentResultOutput

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

    public static class GetIamPolicyDocument 
    {
        public static Task<GetIamPolicyDocumentResult> InvokeAsync(GetIamPolicyDocumentArgs args, InvokeOptions? opts = null)
        public static Output<GetIamPolicyDocumentResult> Invoke(GetIamPolicyDocumentInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetIamPolicyDocumentResult> getIamPolicyDocument(GetIamPolicyDocumentArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: minio:index/getIamPolicyDocument:getIamPolicyDocument
      arguments:
        # arguments dictionary

    The following arguments are supported:

    getIamPolicyDocument Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Json string
    OverrideJson string
    PolicyId string
    SourceJson string
    Statements List<GetIamPolicyDocumentStatement>
    Version string
    Id string
    The provider-assigned unique ID for this managed resource.
    Json string
    OverrideJson string
    PolicyId string
    SourceJson string
    Statements []GetIamPolicyDocumentStatement
    Version string
    id String
    The provider-assigned unique ID for this managed resource.
    json String
    overrideJson String
    policyId String
    sourceJson String
    statements List<GetIamPolicyDocumentStatement>
    version String
    id string
    The provider-assigned unique ID for this managed resource.
    json string
    overrideJson string
    policyId string
    sourceJson string
    statements GetIamPolicyDocumentStatement[]
    version string
    id str
    The provider-assigned unique ID for this managed resource.
    json str
    override_json str
    policy_id str
    source_json str
    statements Sequence[GetIamPolicyDocumentStatement]
    version str
    id String
    The provider-assigned unique ID for this managed resource.
    json String
    overrideJson String
    policyId String
    sourceJson String
    statements List<Property Map>
    version String

    Supporting Types

    GetIamPolicyDocumentStatement

    actions List<String>
    conditions List<Property Map>
    effect String
    principal String
    resources List<String>
    sid String

    GetIamPolicyDocumentStatementCondition

    Test string
    Values List<string>
    Variable string
    Test string
    Values []string
    Variable string
    test String
    values List<String>
    variable String
    test string
    values string[]
    variable string
    test str
    values Sequence[str]
    variable str
    test String
    values List<String>
    variable String

    Package Details

    Repository
    MinIO pulumi/pulumi-minio
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the minio Terraform Provider.
    minio logo
    MinIO v0.15.1 published on Friday, Dec 15, 2023 by Pulumi