1. Packages
  2. Scaleway
  3. API Docs
  4. DocumentdbPrivilege
Scaleway v1.15.0 published on Tuesday, Jul 30, 2024 by pulumiverse

scaleway.DocumentdbPrivilege

Explore with Pulumi AI

scaleway logo
Scaleway v1.15.0 published on Tuesday, Jul 30, 2024 by pulumiverse

    Create and manage Scaleway DocumentDB database privilege.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const instance = new scaleway.DocumentdbInstance("instance", {
        nodeType: "docdb-play2-pico",
        engine: "FerretDB-1",
        userName: "my_initial_user",
        password: "thiZ_is_v&ry_s3cret",
        volumeSizeInGb: 20,
    });
    const main = new scaleway.DocumentdbPrivilege("main", {
        instanceId: instance.id,
        userName: "my-db-user",
        databaseName: "my-db-name",
        permission: "all",
    });
    
    import pulumi
    import pulumiverse_scaleway as scaleway
    
    instance = scaleway.DocumentdbInstance("instance",
        node_type="docdb-play2-pico",
        engine="FerretDB-1",
        user_name="my_initial_user",
        password="thiZ_is_v&ry_s3cret",
        volume_size_in_gb=20)
    main = scaleway.DocumentdbPrivilege("main",
        instance_id=instance.id,
        user_name="my-db-user",
        database_name="my-db-name",
        permission="all")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		instance, err := scaleway.NewDocumentdbInstance(ctx, "instance", &scaleway.DocumentdbInstanceArgs{
    			NodeType:       pulumi.String("docdb-play2-pico"),
    			Engine:         pulumi.String("FerretDB-1"),
    			UserName:       pulumi.String("my_initial_user"),
    			Password:       pulumi.String("thiZ_is_v&ry_s3cret"),
    			VolumeSizeInGb: pulumi.Int(20),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = scaleway.NewDocumentdbPrivilege(ctx, "main", &scaleway.DocumentdbPrivilegeArgs{
    			InstanceId:   instance.ID(),
    			UserName:     pulumi.String("my-db-user"),
    			DatabaseName: pulumi.String("my-db-name"),
    			Permission:   pulumi.String("all"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        var instance = new Scaleway.DocumentdbInstance("instance", new()
        {
            NodeType = "docdb-play2-pico",
            Engine = "FerretDB-1",
            UserName = "my_initial_user",
            Password = "thiZ_is_v&ry_s3cret",
            VolumeSizeInGb = 20,
        });
    
        var main = new Scaleway.DocumentdbPrivilege("main", new()
        {
            InstanceId = instance.Id,
            UserName = "my-db-user",
            DatabaseName = "my-db-name",
            Permission = "all",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.DocumentdbInstance;
    import com.pulumi.scaleway.DocumentdbInstanceArgs;
    import com.pulumi.scaleway.DocumentdbPrivilege;
    import com.pulumi.scaleway.DocumentdbPrivilegeArgs;
    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) {
            var instance = new DocumentdbInstance("instance", DocumentdbInstanceArgs.builder()
                .nodeType("docdb-play2-pico")
                .engine("FerretDB-1")
                .userName("my_initial_user")
                .password("thiZ_is_v&ry_s3cret")
                .volumeSizeInGb(20)
                .build());
    
            var main = new DocumentdbPrivilege("main", DocumentdbPrivilegeArgs.builder()
                .instanceId(instance.id())
                .userName("my-db-user")
                .databaseName("my-db-name")
                .permission("all")
                .build());
    
        }
    }
    
    resources:
      instance:
        type: scaleway:DocumentdbInstance
        properties:
          nodeType: docdb-play2-pico
          engine: FerretDB-1
          userName: my_initial_user
          password: thiZ_is_v&ry_s3cret
          volumeSizeInGb: 20
      main:
        type: scaleway:DocumentdbPrivilege
        properties:
          instanceId: ${instance.id}
          userName: my-db-user
          databaseName: my-db-name
          permission: all
    

    Create DocumentdbPrivilege Resource

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

    Constructor syntax

    new DocumentdbPrivilege(name: string, args: DocumentdbPrivilegeArgs, opts?: CustomResourceOptions);
    @overload
    def DocumentdbPrivilege(resource_name: str,
                            args: DocumentdbPrivilegeArgs,
                            opts: Optional[ResourceOptions] = None)
    
    @overload
    def DocumentdbPrivilege(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            database_name: Optional[str] = None,
                            instance_id: Optional[str] = None,
                            permission: Optional[str] = None,
                            user_name: Optional[str] = None,
                            region: Optional[str] = None)
    func NewDocumentdbPrivilege(ctx *Context, name string, args DocumentdbPrivilegeArgs, opts ...ResourceOption) (*DocumentdbPrivilege, error)
    public DocumentdbPrivilege(string name, DocumentdbPrivilegeArgs args, CustomResourceOptions? opts = null)
    public DocumentdbPrivilege(String name, DocumentdbPrivilegeArgs args)
    public DocumentdbPrivilege(String name, DocumentdbPrivilegeArgs args, CustomResourceOptions options)
    
    type: scaleway:DocumentdbPrivilege
    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 DocumentdbPrivilegeArgs
    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 DocumentdbPrivilegeArgs
    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 DocumentdbPrivilegeArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DocumentdbPrivilegeArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DocumentdbPrivilegeArgs
    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 documentdbPrivilegeResource = new Scaleway.DocumentdbPrivilege("documentdbPrivilegeResource", new()
    {
        DatabaseName = "string",
        InstanceId = "string",
        Permission = "string",
        UserName = "string",
        Region = "string",
    });
    
    example, err := scaleway.NewDocumentdbPrivilege(ctx, "documentdbPrivilegeResource", &scaleway.DocumentdbPrivilegeArgs{
    	DatabaseName: pulumi.String("string"),
    	InstanceId:   pulumi.String("string"),
    	Permission:   pulumi.String("string"),
    	UserName:     pulumi.String("string"),
    	Region:       pulumi.String("string"),
    })
    
    var documentdbPrivilegeResource = new DocumentdbPrivilege("documentdbPrivilegeResource", DocumentdbPrivilegeArgs.builder()
        .databaseName("string")
        .instanceId("string")
        .permission("string")
        .userName("string")
        .region("string")
        .build());
    
    documentdb_privilege_resource = scaleway.DocumentdbPrivilege("documentdbPrivilegeResource",
        database_name="string",
        instance_id="string",
        permission="string",
        user_name="string",
        region="string")
    
    const documentdbPrivilegeResource = new scaleway.DocumentdbPrivilege("documentdbPrivilegeResource", {
        databaseName: "string",
        instanceId: "string",
        permission: "string",
        userName: "string",
        region: "string",
    });
    
    type: scaleway:DocumentdbPrivilege
    properties:
        databaseName: string
        instanceId: string
        permission: string
        region: string
        userName: string
    

    DocumentdbPrivilege 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 DocumentdbPrivilege resource accepts the following input properties:

    DatabaseName string
    Name of the database (e.g. my-db-name).
    InstanceId string
    UUID of the rdb instance.
    Permission string
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    UserName string
    Name of the user (e.g. my-db-user).
    Region string
    region) The region in which the resource exists.
    DatabaseName string
    Name of the database (e.g. my-db-name).
    InstanceId string
    UUID of the rdb instance.
    Permission string
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    UserName string
    Name of the user (e.g. my-db-user).
    Region string
    region) The region in which the resource exists.
    databaseName String
    Name of the database (e.g. my-db-name).
    instanceId String
    UUID of the rdb instance.
    permission String
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    userName String
    Name of the user (e.g. my-db-user).
    region String
    region) The region in which the resource exists.
    databaseName string
    Name of the database (e.g. my-db-name).
    instanceId string
    UUID of the rdb instance.
    permission string
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    userName string
    Name of the user (e.g. my-db-user).
    region string
    region) The region in which the resource exists.
    database_name str
    Name of the database (e.g. my-db-name).
    instance_id str
    UUID of the rdb instance.
    permission str
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    user_name str
    Name of the user (e.g. my-db-user).
    region str
    region) The region in which the resource exists.
    databaseName String
    Name of the database (e.g. my-db-name).
    instanceId String
    UUID of the rdb instance.
    permission String
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    userName String
    Name of the user (e.g. my-db-user).
    region String
    region) The region in which the resource exists.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DocumentdbPrivilege 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 DocumentdbPrivilege Resource

    Get an existing DocumentdbPrivilege 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?: DocumentdbPrivilegeState, opts?: CustomResourceOptions): DocumentdbPrivilege
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            database_name: Optional[str] = None,
            instance_id: Optional[str] = None,
            permission: Optional[str] = None,
            region: Optional[str] = None,
            user_name: Optional[str] = None) -> DocumentdbPrivilege
    func GetDocumentdbPrivilege(ctx *Context, name string, id IDInput, state *DocumentdbPrivilegeState, opts ...ResourceOption) (*DocumentdbPrivilege, error)
    public static DocumentdbPrivilege Get(string name, Input<string> id, DocumentdbPrivilegeState? state, CustomResourceOptions? opts = null)
    public static DocumentdbPrivilege get(String name, Output<String> id, DocumentdbPrivilegeState 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:
    DatabaseName string
    Name of the database (e.g. my-db-name).
    InstanceId string
    UUID of the rdb instance.
    Permission string
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    Region string
    region) The region in which the resource exists.
    UserName string
    Name of the user (e.g. my-db-user).
    DatabaseName string
    Name of the database (e.g. my-db-name).
    InstanceId string
    UUID of the rdb instance.
    Permission string
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    Region string
    region) The region in which the resource exists.
    UserName string
    Name of the user (e.g. my-db-user).
    databaseName String
    Name of the database (e.g. my-db-name).
    instanceId String
    UUID of the rdb instance.
    permission String
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    region String
    region) The region in which the resource exists.
    userName String
    Name of the user (e.g. my-db-user).
    databaseName string
    Name of the database (e.g. my-db-name).
    instanceId string
    UUID of the rdb instance.
    permission string
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    region string
    region) The region in which the resource exists.
    userName string
    Name of the user (e.g. my-db-user).
    database_name str
    Name of the database (e.g. my-db-name).
    instance_id str
    UUID of the rdb instance.
    permission str
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    region str
    region) The region in which the resource exists.
    user_name str
    Name of the user (e.g. my-db-user).
    databaseName String
    Name of the database (e.g. my-db-name).
    instanceId String
    UUID of the rdb instance.
    permission String
    Permission to set. Valid values are readonly, readwrite, all, custom and none.
    region String
    region) The region in which the resource exists.
    userName String
    Name of the user (e.g. my-db-user).

    Import

    The user privileges can be imported using the {region}/{instance_id}/{database_name}/{user_name}, e.g.

    bash

    $ pulumi import scaleway:index/documentdbPrivilege:DocumentdbPrivilege o fr-par/11111111-1111-1111-1111-111111111111/database_name/foo
    

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

    Package Details

    Repository
    scaleway pulumiverse/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Scaleway v1.15.0 published on Tuesday, Jul 30, 2024 by pulumiverse