1. Packages
  2. Aiven Provider
  3. API Docs
  4. OrganizationPermission
Aiven v6.25.0 published on Friday, Sep 27, 2024 by Pulumi

aiven.OrganizationPermission

Explore with Pulumi AI

aiven logo
Aiven v6.25.0 published on Friday, Sep 27, 2024 by Pulumi

    Grants permissions to a principal for a resource.

    This resource is in the beta stage and may change without notice. Set the PROVIDER_AIVEN_ENABLE_BETA environment variable to use the resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aiven from "@pulumi/aiven";
    
    // Grant permission to a user
    const operator = new aiven.OrganizationPermission("operator", {
        organizationId: main.id,
        resourceId: exampleProject.id,
        resourceType: "project",
        permissions: [{
            permissions: ["operator"],
            principalId: "u123a456b7890c",
            principalType: "user",
        }],
    });
    // Grant permission to a group
    const developers = new aiven.OrganizationPermission("developers", {
        organizationId: main.id,
        resourceId: exampleProject.id,
        resourceType: "project",
        permissions: [{
            permissions: ["developer"],
            principalId: exampleGroup.groupId,
            principalType: "user_group",
        }],
    });
    
    import pulumi
    import pulumi_aiven as aiven
    
    # Grant permission to a user
    operator = aiven.OrganizationPermission("operator",
        organization_id=main["id"],
        resource_id=example_project["id"],
        resource_type="project",
        permissions=[{
            "permissions": ["operator"],
            "principal_id": "u123a456b7890c",
            "principal_type": "user",
        }])
    # Grant permission to a group
    developers = aiven.OrganizationPermission("developers",
        organization_id=main["id"],
        resource_id=example_project["id"],
        resource_type="project",
        permissions=[{
            "permissions": ["developer"],
            "principal_id": example_group["groupId"],
            "principal_type": "user_group",
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Grant permission to a user
    		_, err := aiven.NewOrganizationPermission(ctx, "operator", &aiven.OrganizationPermissionArgs{
    			OrganizationId: pulumi.Any(main.Id),
    			ResourceId:     pulumi.Any(exampleProject.Id),
    			ResourceType:   pulumi.String("project"),
    			Permissions: aiven.OrganizationPermissionPermissionArray{
    				&aiven.OrganizationPermissionPermissionArgs{
    					Permissions: pulumi.StringArray{
    						pulumi.String("operator"),
    					},
    					PrincipalId:   pulumi.String("u123a456b7890c"),
    					PrincipalType: pulumi.String("user"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Grant permission to a group
    		_, err = aiven.NewOrganizationPermission(ctx, "developers", &aiven.OrganizationPermissionArgs{
    			OrganizationId: pulumi.Any(main.Id),
    			ResourceId:     pulumi.Any(exampleProject.Id),
    			ResourceType:   pulumi.String("project"),
    			Permissions: aiven.OrganizationPermissionPermissionArray{
    				&aiven.OrganizationPermissionPermissionArgs{
    					Permissions: pulumi.StringArray{
    						pulumi.String("developer"),
    					},
    					PrincipalId:   pulumi.Any(exampleGroup.GroupId),
    					PrincipalType: pulumi.String("user_group"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aiven = Pulumi.Aiven;
    
    return await Deployment.RunAsync(() => 
    {
        // Grant permission to a user
        var @operator = new Aiven.OrganizationPermission("operator", new()
        {
            OrganizationId = main.Id,
            ResourceId = exampleProject.Id,
            ResourceType = "project",
            Permissions = new[]
            {
                new Aiven.Inputs.OrganizationPermissionPermissionArgs
                {
                    Permissions = new[]
                    {
                        "operator",
                    },
                    PrincipalId = "u123a456b7890c",
                    PrincipalType = "user",
                },
            },
        });
    
        // Grant permission to a group
        var developers = new Aiven.OrganizationPermission("developers", new()
        {
            OrganizationId = main.Id,
            ResourceId = exampleProject.Id,
            ResourceType = "project",
            Permissions = new[]
            {
                new Aiven.Inputs.OrganizationPermissionPermissionArgs
                {
                    Permissions = new[]
                    {
                        "developer",
                    },
                    PrincipalId = exampleGroup.GroupId,
                    PrincipalType = "user_group",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aiven.OrganizationPermission;
    import com.pulumi.aiven.OrganizationPermissionArgs;
    import com.pulumi.aiven.inputs.OrganizationPermissionPermissionArgs;
    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) {
            // Grant permission to a user
            var operator = new OrganizationPermission("operator", OrganizationPermissionArgs.builder()
                .organizationId(main.id())
                .resourceId(exampleProject.id())
                .resourceType("project")
                .permissions(OrganizationPermissionPermissionArgs.builder()
                    .permissions("operator")
                    .principalId("u123a456b7890c")
                    .principalType("user")
                    .build())
                .build());
    
            // Grant permission to a group
            var developers = new OrganizationPermission("developers", OrganizationPermissionArgs.builder()
                .organizationId(main.id())
                .resourceId(exampleProject.id())
                .resourceType("project")
                .permissions(OrganizationPermissionPermissionArgs.builder()
                    .permissions("developer")
                    .principalId(exampleGroup.groupId())
                    .principalType("user_group")
                    .build())
                .build());
    
        }
    }
    
    resources:
      # Grant permission to a user
      operator:
        type: aiven:OrganizationPermission
        properties:
          organizationId: ${main.id}
          resourceId: ${exampleProject.id}
          resourceType: project
          permissions:
            - permissions:
                - operator
              principalId: u123a456b7890c
              principalType: user
      # Grant permission to a group
      developers:
        type: aiven:OrganizationPermission
        properties:
          organizationId: ${main.id}
          resourceId: ${exampleProject.id}
          resourceType: project
          permissions:
            - permissions:
                - developer
              principalId: ${exampleGroup.groupId}
              principalType: user_group
    

    Create OrganizationPermission Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new OrganizationPermission(name: string, args: OrganizationPermissionArgs, opts?: CustomResourceOptions);
    @overload
    def OrganizationPermission(resource_name: str,
                               args: OrganizationPermissionArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def OrganizationPermission(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               organization_id: Optional[str] = None,
                               permissions: Optional[Sequence[OrganizationPermissionPermissionArgs]] = None,
                               resource_id: Optional[str] = None,
                               resource_type: Optional[str] = None)
    func NewOrganizationPermission(ctx *Context, name string, args OrganizationPermissionArgs, opts ...ResourceOption) (*OrganizationPermission, error)
    public OrganizationPermission(string name, OrganizationPermissionArgs args, CustomResourceOptions? opts = null)
    public OrganizationPermission(String name, OrganizationPermissionArgs args)
    public OrganizationPermission(String name, OrganizationPermissionArgs args, CustomResourceOptions options)
    
    type: aiven:OrganizationPermission
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args OrganizationPermissionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args OrganizationPermissionArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args OrganizationPermissionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args OrganizationPermissionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args OrganizationPermissionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var organizationPermissionResource = new Aiven.OrganizationPermission("organizationPermissionResource", new()
    {
        OrganizationId = "string",
        Permissions = new[]
        {
            new Aiven.Inputs.OrganizationPermissionPermissionArgs
            {
                Permissions = new[]
                {
                    "string",
                },
                PrincipalId = "string",
                PrincipalType = "string",
                CreateTime = "string",
                UpdateTime = "string",
            },
        },
        ResourceId = "string",
        ResourceType = "string",
    });
    
    example, err := aiven.NewOrganizationPermission(ctx, "organizationPermissionResource", &aiven.OrganizationPermissionArgs{
    	OrganizationId: pulumi.String("string"),
    	Permissions: aiven.OrganizationPermissionPermissionArray{
    		&aiven.OrganizationPermissionPermissionArgs{
    			Permissions: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			PrincipalId:   pulumi.String("string"),
    			PrincipalType: pulumi.String("string"),
    			CreateTime:    pulumi.String("string"),
    			UpdateTime:    pulumi.String("string"),
    		},
    	},
    	ResourceId:   pulumi.String("string"),
    	ResourceType: pulumi.String("string"),
    })
    
    var organizationPermissionResource = new OrganizationPermission("organizationPermissionResource", OrganizationPermissionArgs.builder()
        .organizationId("string")
        .permissions(OrganizationPermissionPermissionArgs.builder()
            .permissions("string")
            .principalId("string")
            .principalType("string")
            .createTime("string")
            .updateTime("string")
            .build())
        .resourceId("string")
        .resourceType("string")
        .build());
    
    organization_permission_resource = aiven.OrganizationPermission("organizationPermissionResource",
        organization_id="string",
        permissions=[aiven.OrganizationPermissionPermissionArgs(
            permissions=["string"],
            principal_id="string",
            principal_type="string",
            create_time="string",
            update_time="string",
        )],
        resource_id="string",
        resource_type="string")
    
    const organizationPermissionResource = new aiven.OrganizationPermission("organizationPermissionResource", {
        organizationId: "string",
        permissions: [{
            permissions: ["string"],
            principalId: "string",
            principalType: "string",
            createTime: "string",
            updateTime: "string",
        }],
        resourceId: "string",
        resourceType: "string",
    });
    
    type: aiven:OrganizationPermission
    properties:
        organizationId: string
        permissions:
            - createTime: string
              permissions:
                - string
              principalId: string
              principalType: string
              updateTime: string
        resourceId: string
        resourceType: string
    

    OrganizationPermission Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The OrganizationPermission resource accepts the following input properties:

    OrganizationId string
    Organization ID.
    Permissions List<OrganizationPermissionPermission>
    Permissions to grant to principals.
    ResourceId string
    Resource ID.
    ResourceType string
    Resource type. The possible values are project.
    OrganizationId string
    Organization ID.
    Permissions []OrganizationPermissionPermissionArgs
    Permissions to grant to principals.
    ResourceId string
    Resource ID.
    ResourceType string
    Resource type. The possible values are project.
    organizationId String
    Organization ID.
    permissions List<OrganizationPermissionPermission>
    Permissions to grant to principals.
    resourceId String
    Resource ID.
    resourceType String
    Resource type. The possible values are project.
    organizationId string
    Organization ID.
    permissions OrganizationPermissionPermission[]
    Permissions to grant to principals.
    resourceId string
    Resource ID.
    resourceType string
    Resource type. The possible values are project.
    organization_id str
    Organization ID.
    permissions Sequence[OrganizationPermissionPermissionArgs]
    Permissions to grant to principals.
    resource_id str
    Resource ID.
    resource_type str
    Resource type. The possible values are project.
    organizationId String
    Organization ID.
    permissions List<Property Map>
    Permissions to grant to principals.
    resourceId String
    Resource ID.
    resourceType String
    Resource type. The possible values are project.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the OrganizationPermission resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing OrganizationPermission Resource

    Get an existing OrganizationPermission resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: OrganizationPermissionState, opts?: CustomResourceOptions): OrganizationPermission
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            organization_id: Optional[str] = None,
            permissions: Optional[Sequence[OrganizationPermissionPermissionArgs]] = None,
            resource_id: Optional[str] = None,
            resource_type: Optional[str] = None) -> OrganizationPermission
    func GetOrganizationPermission(ctx *Context, name string, id IDInput, state *OrganizationPermissionState, opts ...ResourceOption) (*OrganizationPermission, error)
    public static OrganizationPermission Get(string name, Input<string> id, OrganizationPermissionState? state, CustomResourceOptions? opts = null)
    public static OrganizationPermission get(String name, Output<String> id, OrganizationPermissionState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    OrganizationId string
    Organization ID.
    Permissions List<OrganizationPermissionPermission>
    Permissions to grant to principals.
    ResourceId string
    Resource ID.
    ResourceType string
    Resource type. The possible values are project.
    OrganizationId string
    Organization ID.
    Permissions []OrganizationPermissionPermissionArgs
    Permissions to grant to principals.
    ResourceId string
    Resource ID.
    ResourceType string
    Resource type. The possible values are project.
    organizationId String
    Organization ID.
    permissions List<OrganizationPermissionPermission>
    Permissions to grant to principals.
    resourceId String
    Resource ID.
    resourceType String
    Resource type. The possible values are project.
    organizationId string
    Organization ID.
    permissions OrganizationPermissionPermission[]
    Permissions to grant to principals.
    resourceId string
    Resource ID.
    resourceType string
    Resource type. The possible values are project.
    organization_id str
    Organization ID.
    permissions Sequence[OrganizationPermissionPermissionArgs]
    Permissions to grant to principals.
    resource_id str
    Resource ID.
    resource_type str
    Resource type. The possible values are project.
    organizationId String
    Organization ID.
    permissions List<Property Map>
    Permissions to grant to principals.
    resourceId String
    Resource ID.
    resourceType String
    Resource type. The possible values are project.

    Supporting Types

    OrganizationPermissionPermission, OrganizationPermissionPermissionArgs

    Permissions List<string>
    List of permissions. The possible values are admin, developer, operator and read_only.
    PrincipalId string
    ID of the user or group.
    PrincipalType string
    The type of principal. The possible values are user and user_group.
    CreateTime string
    Time created.
    UpdateTime string
    Time updated.
    Permissions []string
    List of permissions. The possible values are admin, developer, operator and read_only.
    PrincipalId string
    ID of the user or group.
    PrincipalType string
    The type of principal. The possible values are user and user_group.
    CreateTime string
    Time created.
    UpdateTime string
    Time updated.
    permissions List<String>
    List of permissions. The possible values are admin, developer, operator and read_only.
    principalId String
    ID of the user or group.
    principalType String
    The type of principal. The possible values are user and user_group.
    createTime String
    Time created.
    updateTime String
    Time updated.
    permissions string[]
    List of permissions. The possible values are admin, developer, operator and read_only.
    principalId string
    ID of the user or group.
    principalType string
    The type of principal. The possible values are user and user_group.
    createTime string
    Time created.
    updateTime string
    Time updated.
    permissions Sequence[str]
    List of permissions. The possible values are admin, developer, operator and read_only.
    principal_id str
    ID of the user or group.
    principal_type str
    The type of principal. The possible values are user and user_group.
    create_time str
    Time created.
    update_time str
    Time updated.
    permissions List<String>
    List of permissions. The possible values are admin, developer, operator and read_only.
    principalId String
    ID of the user or group.
    principalType String
    The type of principal. The possible values are user and user_group.
    createTime String
    Time created.
    updateTime String
    Time updated.

    Import

    $ pulumi import aiven:index/organizationPermission:OrganizationPermission operator ORGANIZATION_ID/ID
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Aiven pulumi/pulumi-aiven
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aiven Terraform Provider.
    aiven logo
    Aiven v6.25.0 published on Friday, Sep 27, 2024 by Pulumi