1. Packages
  2. PostgreSQL
  3. API Docs
  4. Subscription
PostgreSQL v3.11.0 published on Sunday, Mar 3, 2024 by Pulumi

postgresql.Subscription

Explore with Pulumi AI

postgresql logo
PostgreSQL v3.11.0 published on Sunday, Mar 3, 2024 by Pulumi

    The postgresql.Subscription resource creates and manages a publication on a PostgreSQL server.

    Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as postgresql from "@pulumi/postgresql";
    
    const subscription = new postgresql.Subscription("subscription", {
        conninfo: "host=localhost port=5432 dbname=mydb user=postgres password=postgres",
        publications: ["publication"],
    });
    
    import pulumi
    import pulumi_postgresql as postgresql
    
    subscription = postgresql.Subscription("subscription",
        conninfo="host=localhost port=5432 dbname=mydb user=postgres password=postgres",
        publications=["publication"])
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using PostgreSql = Pulumi.PostgreSql;
    
    return await Deployment.RunAsync(() => 
    {
        var subscription = new PostgreSql.Subscription("subscription", new()
        {
            Conninfo = "host=localhost port=5432 dbname=mydb user=postgres password=postgres",
            Publications = new[]
            {
                "publication",
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-postgresql/sdk/v3/go/postgresql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := postgresql.NewSubscription(ctx, "subscription", &postgresql.SubscriptionArgs{
    			Conninfo: pulumi.String("host=localhost port=5432 dbname=mydb user=postgres password=postgres"),
    			Publications: pulumi.StringArray{
    				pulumi.String("publication"),
    			},
    		})
    		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.postgresql.Subscription;
    import com.pulumi.postgresql.SubscriptionArgs;
    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 subscription = new Subscription("subscription", SubscriptionArgs.builder()        
                .conninfo("host=localhost port=5432 dbname=mydb user=postgres password=postgres")
                .publications("publication")
                .build());
    
        }
    }
    
    resources:
      subscription:
        type: postgresql:Subscription
        properties:
          conninfo: host=localhost port=5432 dbname=mydb user=postgres password=postgres
          publications:
            - publication
    

    Postgres documentation

    • https://www.postgresql.org/docs/current/sql-createsubscription.html

    Create Subscription Resource

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

    Constructor syntax

    new Subscription(name: string, args: SubscriptionArgs, opts?: CustomResourceOptions);
    @overload
    def Subscription(resource_name: str,
                     args: SubscriptionArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def Subscription(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     conninfo: Optional[str] = None,
                     publications: Optional[Sequence[str]] = None,
                     create_slot: Optional[bool] = None,
                     database: Optional[str] = None,
                     name: Optional[str] = None,
                     slot_name: Optional[str] = None)
    func NewSubscription(ctx *Context, name string, args SubscriptionArgs, opts ...ResourceOption) (*Subscription, error)
    public Subscription(string name, SubscriptionArgs args, CustomResourceOptions? opts = null)
    public Subscription(String name, SubscriptionArgs args)
    public Subscription(String name, SubscriptionArgs args, CustomResourceOptions options)
    
    type: postgresql:Subscription
    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 SubscriptionArgs
    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 SubscriptionArgs
    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 SubscriptionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SubscriptionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SubscriptionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var subscriptionResource = new PostgreSql.Subscription("subscriptionResource", new()
    {
        Conninfo = "string",
        Publications = new[]
        {
            "string",
        },
        CreateSlot = false,
        Database = "string",
        Name = "string",
        SlotName = "string",
    });
    
    example, err := postgresql.NewSubscription(ctx, "subscriptionResource", &postgresql.SubscriptionArgs{
    	Conninfo: pulumi.String("string"),
    	Publications: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	CreateSlot: pulumi.Bool(false),
    	Database:   pulumi.String("string"),
    	Name:       pulumi.String("string"),
    	SlotName:   pulumi.String("string"),
    })
    
    var subscriptionResource = new Subscription("subscriptionResource", SubscriptionArgs.builder()        
        .conninfo("string")
        .publications("string")
        .createSlot(false)
        .database("string")
        .name("string")
        .slotName("string")
        .build());
    
    subscription_resource = postgresql.Subscription("subscriptionResource",
        conninfo="string",
        publications=["string"],
        create_slot=False,
        database="string",
        name="string",
        slot_name="string")
    
    const subscriptionResource = new postgresql.Subscription("subscriptionResource", {
        conninfo: "string",
        publications: ["string"],
        createSlot: false,
        database: "string",
        name: "string",
        slotName: "string",
    });
    
    type: postgresql:Subscription
    properties:
        conninfo: string
        createSlot: false
        database: string
        name: string
        publications:
            - string
        slotName: string
    

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

    Conninfo string
    The connection string to the publisher. It should follow the keyword/value format
    Publications List<string>
    Names of the publications on the publisher to subscribe to
    CreateSlot bool
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    Database string
    Which database to create the subscription on. Defaults to provider database.
    Name string
    The name of the publication.
    SlotName string
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name
    Conninfo string
    The connection string to the publisher. It should follow the keyword/value format
    Publications []string
    Names of the publications on the publisher to subscribe to
    CreateSlot bool
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    Database string
    Which database to create the subscription on. Defaults to provider database.
    Name string
    The name of the publication.
    SlotName string
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name
    conninfo String
    The connection string to the publisher. It should follow the keyword/value format
    publications List<String>
    Names of the publications on the publisher to subscribe to
    createSlot Boolean
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    database String
    Which database to create the subscription on. Defaults to provider database.
    name String
    The name of the publication.
    slotName String
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name
    conninfo string
    The connection string to the publisher. It should follow the keyword/value format
    publications string[]
    Names of the publications on the publisher to subscribe to
    createSlot boolean
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    database string
    Which database to create the subscription on. Defaults to provider database.
    name string
    The name of the publication.
    slotName string
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name
    conninfo str
    The connection string to the publisher. It should follow the keyword/value format
    publications Sequence[str]
    Names of the publications on the publisher to subscribe to
    create_slot bool
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    database str
    Which database to create the subscription on. Defaults to provider database.
    name str
    The name of the publication.
    slot_name str
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name
    conninfo String
    The connection string to the publisher. It should follow the keyword/value format
    publications List<String>
    Names of the publications on the publisher to subscribe to
    createSlot Boolean
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    database String
    Which database to create the subscription on. Defaults to provider database.
    name String
    The name of the publication.
    slotName String
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name

    Outputs

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

    Get an existing Subscription 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?: SubscriptionState, opts?: CustomResourceOptions): Subscription
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            conninfo: Optional[str] = None,
            create_slot: Optional[bool] = None,
            database: Optional[str] = None,
            name: Optional[str] = None,
            publications: Optional[Sequence[str]] = None,
            slot_name: Optional[str] = None) -> Subscription
    func GetSubscription(ctx *Context, name string, id IDInput, state *SubscriptionState, opts ...ResourceOption) (*Subscription, error)
    public static Subscription Get(string name, Input<string> id, SubscriptionState? state, CustomResourceOptions? opts = null)
    public static Subscription get(String name, Output<String> id, SubscriptionState 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:
    Conninfo string
    The connection string to the publisher. It should follow the keyword/value format
    CreateSlot bool
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    Database string
    Which database to create the subscription on. Defaults to provider database.
    Name string
    The name of the publication.
    Publications List<string>
    Names of the publications on the publisher to subscribe to
    SlotName string
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name
    Conninfo string
    The connection string to the publisher. It should follow the keyword/value format
    CreateSlot bool
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    Database string
    Which database to create the subscription on. Defaults to provider database.
    Name string
    The name of the publication.
    Publications []string
    Names of the publications on the publisher to subscribe to
    SlotName string
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name
    conninfo String
    The connection string to the publisher. It should follow the keyword/value format
    createSlot Boolean
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    database String
    Which database to create the subscription on. Defaults to provider database.
    name String
    The name of the publication.
    publications List<String>
    Names of the publications on the publisher to subscribe to
    slotName String
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name
    conninfo string
    The connection string to the publisher. It should follow the keyword/value format
    createSlot boolean
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    database string
    Which database to create the subscription on. Defaults to provider database.
    name string
    The name of the publication.
    publications string[]
    Names of the publications on the publisher to subscribe to
    slotName string
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name
    conninfo str
    The connection string to the publisher. It should follow the keyword/value format
    create_slot bool
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    database str
    Which database to create the subscription on. Defaults to provider database.
    name str
    The name of the publication.
    publications Sequence[str]
    Names of the publications on the publisher to subscribe to
    slot_name str
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name
    conninfo String
    The connection string to the publisher. It should follow the keyword/value format
    createSlot Boolean
    Specifies whether the command should create the replication slot on the publisher. Default behavior is true
    database String
    Which database to create the subscription on. Defaults to provider database.
    name String
    The name of the publication.
    publications List<String>
    Names of the publications on the publisher to subscribe to
    slotName String
    Name of the replication slot to use. The default behavior is to use the name of the subscription for the slot name

    Package Details

    Repository
    PostgreSQL pulumi/pulumi-postgresql
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the postgresql Terraform Provider.
    postgresql logo
    PostgreSQL v3.11.0 published on Sunday, Mar 3, 2024 by Pulumi