1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. pubsub
  5. LiteSubscription
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.pubsub.LiteSubscription

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    A named resource representing the stream of messages from a single, specific topic, to be delivered to the subscribing application.

    To get more information about Subscription, see:

    Example Usage

    Pubsub Lite Subscription Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const project = gcp.organizations.getProject({});
    const example = new gcp.pubsub.LiteTopic("example", {
        name: "example-topic",
        project: project.then(project => project.number),
        partitionConfig: {
            count: 1,
            capacity: {
                publishMibPerSec: 4,
                subscribeMibPerSec: 8,
            },
        },
        retentionConfig: {
            perPartitionBytes: "32212254720",
        },
    });
    const exampleLiteSubscription = new gcp.pubsub.LiteSubscription("example", {
        name: "example-subscription",
        topic: example.name,
        deliveryConfig: {
            deliveryRequirement: "DELIVER_AFTER_STORED",
        },
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    project = gcp.organizations.get_project()
    example = gcp.pubsub.LiteTopic("example",
        name="example-topic",
        project=project.number,
        partition_config={
            "count": 1,
            "capacity": {
                "publish_mib_per_sec": 4,
                "subscribe_mib_per_sec": 8,
            },
        },
        retention_config={
            "per_partition_bytes": "32212254720",
        })
    example_lite_subscription = gcp.pubsub.LiteSubscription("example",
        name="example-subscription",
        topic=example.name,
        delivery_config={
            "delivery_requirement": "DELIVER_AFTER_STORED",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/pubsub"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		example, err := pubsub.NewLiteTopic(ctx, "example", &pubsub.LiteTopicArgs{
    			Name:    pulumi.String("example-topic"),
    			Project: pulumi.String(project.Number),
    			PartitionConfig: &pubsub.LiteTopicPartitionConfigArgs{
    				Count: pulumi.Int(1),
    				Capacity: &pubsub.LiteTopicPartitionConfigCapacityArgs{
    					PublishMibPerSec:   pulumi.Int(4),
    					SubscribeMibPerSec: pulumi.Int(8),
    				},
    			},
    			RetentionConfig: &pubsub.LiteTopicRetentionConfigArgs{
    				PerPartitionBytes: pulumi.String("32212254720"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = pubsub.NewLiteSubscription(ctx, "example", &pubsub.LiteSubscriptionArgs{
    			Name:  pulumi.String("example-subscription"),
    			Topic: example.Name,
    			DeliveryConfig: &pubsub.LiteSubscriptionDeliveryConfigArgs{
    				DeliveryRequirement: pulumi.String("DELIVER_AFTER_STORED"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var project = Gcp.Organizations.GetProject.Invoke();
    
        var example = new Gcp.PubSub.LiteTopic("example", new()
        {
            Name = "example-topic",
            Project = project.Apply(getProjectResult => getProjectResult.Number),
            PartitionConfig = new Gcp.PubSub.Inputs.LiteTopicPartitionConfigArgs
            {
                Count = 1,
                Capacity = new Gcp.PubSub.Inputs.LiteTopicPartitionConfigCapacityArgs
                {
                    PublishMibPerSec = 4,
                    SubscribeMibPerSec = 8,
                },
            },
            RetentionConfig = new Gcp.PubSub.Inputs.LiteTopicRetentionConfigArgs
            {
                PerPartitionBytes = "32212254720",
            },
        });
    
        var exampleLiteSubscription = new Gcp.PubSub.LiteSubscription("example", new()
        {
            Name = "example-subscription",
            Topic = example.Name,
            DeliveryConfig = new Gcp.PubSub.Inputs.LiteSubscriptionDeliveryConfigArgs
            {
                DeliveryRequirement = "DELIVER_AFTER_STORED",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.organizations.OrganizationsFunctions;
    import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
    import com.pulumi.gcp.pubsub.LiteTopic;
    import com.pulumi.gcp.pubsub.LiteTopicArgs;
    import com.pulumi.gcp.pubsub.inputs.LiteTopicPartitionConfigArgs;
    import com.pulumi.gcp.pubsub.inputs.LiteTopicPartitionConfigCapacityArgs;
    import com.pulumi.gcp.pubsub.inputs.LiteTopicRetentionConfigArgs;
    import com.pulumi.gcp.pubsub.LiteSubscription;
    import com.pulumi.gcp.pubsub.LiteSubscriptionArgs;
    import com.pulumi.gcp.pubsub.inputs.LiteSubscriptionDeliveryConfigArgs;
    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 project = OrganizationsFunctions.getProject();
    
            var example = new LiteTopic("example", LiteTopicArgs.builder()
                .name("example-topic")
                .project(project.applyValue(getProjectResult -> getProjectResult.number()))
                .partitionConfig(LiteTopicPartitionConfigArgs.builder()
                    .count(1)
                    .capacity(LiteTopicPartitionConfigCapacityArgs.builder()
                        .publishMibPerSec(4)
                        .subscribeMibPerSec(8)
                        .build())
                    .build())
                .retentionConfig(LiteTopicRetentionConfigArgs.builder()
                    .perPartitionBytes(32212254720)
                    .build())
                .build());
    
            var exampleLiteSubscription = new LiteSubscription("exampleLiteSubscription", LiteSubscriptionArgs.builder()
                .name("example-subscription")
                .topic(example.name())
                .deliveryConfig(LiteSubscriptionDeliveryConfigArgs.builder()
                    .deliveryRequirement("DELIVER_AFTER_STORED")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: gcp:pubsub:LiteTopic
        properties:
          name: example-topic
          project: ${project.number}
          partitionConfig:
            count: 1
            capacity:
              publishMibPerSec: 4
              subscribeMibPerSec: 8
          retentionConfig:
            perPartitionBytes: 3.221225472e+10
      exampleLiteSubscription:
        type: gcp:pubsub:LiteSubscription
        name: example
        properties:
          name: example-subscription
          topic: ${example.name}
          deliveryConfig:
            deliveryRequirement: DELIVER_AFTER_STORED
    variables:
      project:
        fn::invoke:
          Function: gcp:organizations:getProject
          Arguments: {}
    

    Create LiteSubscription Resource

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

    Constructor syntax

    new LiteSubscription(name: string, args: LiteSubscriptionArgs, opts?: CustomResourceOptions);
    @overload
    def LiteSubscription(resource_name: str,
                         args: LiteSubscriptionArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def LiteSubscription(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         topic: Optional[str] = None,
                         delivery_config: Optional[LiteSubscriptionDeliveryConfigArgs] = None,
                         name: Optional[str] = None,
                         project: Optional[str] = None,
                         region: Optional[str] = None,
                         zone: Optional[str] = None)
    func NewLiteSubscription(ctx *Context, name string, args LiteSubscriptionArgs, opts ...ResourceOption) (*LiteSubscription, error)
    public LiteSubscription(string name, LiteSubscriptionArgs args, CustomResourceOptions? opts = null)
    public LiteSubscription(String name, LiteSubscriptionArgs args)
    public LiteSubscription(String name, LiteSubscriptionArgs args, CustomResourceOptions options)
    
    type: gcp:pubsub:LiteSubscription
    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 LiteSubscriptionArgs
    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 LiteSubscriptionArgs
    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 LiteSubscriptionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LiteSubscriptionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LiteSubscriptionArgs
    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 liteSubscriptionResource = new Gcp.PubSub.LiteSubscription("liteSubscriptionResource", new()
    {
        Topic = "string",
        DeliveryConfig = new Gcp.PubSub.Inputs.LiteSubscriptionDeliveryConfigArgs
        {
            DeliveryRequirement = "string",
        },
        Name = "string",
        Project = "string",
        Region = "string",
        Zone = "string",
    });
    
    example, err := pubsub.NewLiteSubscription(ctx, "liteSubscriptionResource", &pubsub.LiteSubscriptionArgs{
    	Topic: pulumi.String("string"),
    	DeliveryConfig: &pubsub.LiteSubscriptionDeliveryConfigArgs{
    		DeliveryRequirement: pulumi.String("string"),
    	},
    	Name:    pulumi.String("string"),
    	Project: pulumi.String("string"),
    	Region:  pulumi.String("string"),
    	Zone:    pulumi.String("string"),
    })
    
    var liteSubscriptionResource = new LiteSubscription("liteSubscriptionResource", LiteSubscriptionArgs.builder()
        .topic("string")
        .deliveryConfig(LiteSubscriptionDeliveryConfigArgs.builder()
            .deliveryRequirement("string")
            .build())
        .name("string")
        .project("string")
        .region("string")
        .zone("string")
        .build());
    
    lite_subscription_resource = gcp.pubsub.LiteSubscription("liteSubscriptionResource",
        topic="string",
        delivery_config={
            "delivery_requirement": "string",
        },
        name="string",
        project="string",
        region="string",
        zone="string")
    
    const liteSubscriptionResource = new gcp.pubsub.LiteSubscription("liteSubscriptionResource", {
        topic: "string",
        deliveryConfig: {
            deliveryRequirement: "string",
        },
        name: "string",
        project: "string",
        region: "string",
        zone: "string",
    });
    
    type: gcp:pubsub:LiteSubscription
    properties:
        deliveryConfig:
            deliveryRequirement: string
        name: string
        project: string
        region: string
        topic: string
        zone: string
    

    LiteSubscription Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The LiteSubscription resource accepts the following input properties:

    Topic string
    A reference to a Topic resource.
    DeliveryConfig LiteSubscriptionDeliveryConfig
    The settings for this subscription's message delivery. Structure is documented below.
    Name string
    Name of the subscription.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    The region of the pubsub lite topic.
    Zone string
    The zone of the pubsub lite topic.
    Topic string
    A reference to a Topic resource.
    DeliveryConfig LiteSubscriptionDeliveryConfigArgs
    The settings for this subscription's message delivery. Structure is documented below.
    Name string
    Name of the subscription.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    The region of the pubsub lite topic.
    Zone string
    The zone of the pubsub lite topic.
    topic String
    A reference to a Topic resource.
    deliveryConfig LiteSubscriptionDeliveryConfig
    The settings for this subscription's message delivery. Structure is documented below.
    name String
    Name of the subscription.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    The region of the pubsub lite topic.
    zone String
    The zone of the pubsub lite topic.
    topic string
    A reference to a Topic resource.
    deliveryConfig LiteSubscriptionDeliveryConfig
    The settings for this subscription's message delivery. Structure is documented below.
    name string
    Name of the subscription.


    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region string
    The region of the pubsub lite topic.
    zone string
    The zone of the pubsub lite topic.
    topic str
    A reference to a Topic resource.
    delivery_config LiteSubscriptionDeliveryConfigArgs
    The settings for this subscription's message delivery. Structure is documented below.
    name str
    Name of the subscription.


    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region str
    The region of the pubsub lite topic.
    zone str
    The zone of the pubsub lite topic.
    topic String
    A reference to a Topic resource.
    deliveryConfig Property Map
    The settings for this subscription's message delivery. Structure is documented below.
    name String
    Name of the subscription.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    The region of the pubsub lite topic.
    zone String
    The zone of the pubsub lite topic.

    Outputs

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

    Get an existing LiteSubscription 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?: LiteSubscriptionState, opts?: CustomResourceOptions): LiteSubscription
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            delivery_config: Optional[LiteSubscriptionDeliveryConfigArgs] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            region: Optional[str] = None,
            topic: Optional[str] = None,
            zone: Optional[str] = None) -> LiteSubscription
    func GetLiteSubscription(ctx *Context, name string, id IDInput, state *LiteSubscriptionState, opts ...ResourceOption) (*LiteSubscription, error)
    public static LiteSubscription Get(string name, Input<string> id, LiteSubscriptionState? state, CustomResourceOptions? opts = null)
    public static LiteSubscription get(String name, Output<String> id, LiteSubscriptionState 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:
    DeliveryConfig LiteSubscriptionDeliveryConfig
    The settings for this subscription's message delivery. Structure is documented below.
    Name string
    Name of the subscription.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    The region of the pubsub lite topic.
    Topic string
    A reference to a Topic resource.
    Zone string
    The zone of the pubsub lite topic.
    DeliveryConfig LiteSubscriptionDeliveryConfigArgs
    The settings for this subscription's message delivery. Structure is documented below.
    Name string
    Name of the subscription.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    The region of the pubsub lite topic.
    Topic string
    A reference to a Topic resource.
    Zone string
    The zone of the pubsub lite topic.
    deliveryConfig LiteSubscriptionDeliveryConfig
    The settings for this subscription's message delivery. Structure is documented below.
    name String
    Name of the subscription.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    The region of the pubsub lite topic.
    topic String
    A reference to a Topic resource.
    zone String
    The zone of the pubsub lite topic.
    deliveryConfig LiteSubscriptionDeliveryConfig
    The settings for this subscription's message delivery. Structure is documented below.
    name string
    Name of the subscription.


    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region string
    The region of the pubsub lite topic.
    topic string
    A reference to a Topic resource.
    zone string
    The zone of the pubsub lite topic.
    delivery_config LiteSubscriptionDeliveryConfigArgs
    The settings for this subscription's message delivery. Structure is documented below.
    name str
    Name of the subscription.


    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region str
    The region of the pubsub lite topic.
    topic str
    A reference to a Topic resource.
    zone str
    The zone of the pubsub lite topic.
    deliveryConfig Property Map
    The settings for this subscription's message delivery. Structure is documented below.
    name String
    Name of the subscription.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    The region of the pubsub lite topic.
    topic String
    A reference to a Topic resource.
    zone String
    The zone of the pubsub lite topic.

    Supporting Types

    LiteSubscriptionDeliveryConfig, LiteSubscriptionDeliveryConfigArgs

    DeliveryRequirement string
    When this subscription should send messages to subscribers relative to messages persistence in storage. Possible values are: DELIVER_IMMEDIATELY, DELIVER_AFTER_STORED, DELIVERY_REQUIREMENT_UNSPECIFIED.
    DeliveryRequirement string
    When this subscription should send messages to subscribers relative to messages persistence in storage. Possible values are: DELIVER_IMMEDIATELY, DELIVER_AFTER_STORED, DELIVERY_REQUIREMENT_UNSPECIFIED.
    deliveryRequirement String
    When this subscription should send messages to subscribers relative to messages persistence in storage. Possible values are: DELIVER_IMMEDIATELY, DELIVER_AFTER_STORED, DELIVERY_REQUIREMENT_UNSPECIFIED.
    deliveryRequirement string
    When this subscription should send messages to subscribers relative to messages persistence in storage. Possible values are: DELIVER_IMMEDIATELY, DELIVER_AFTER_STORED, DELIVERY_REQUIREMENT_UNSPECIFIED.
    delivery_requirement str
    When this subscription should send messages to subscribers relative to messages persistence in storage. Possible values are: DELIVER_IMMEDIATELY, DELIVER_AFTER_STORED, DELIVERY_REQUIREMENT_UNSPECIFIED.
    deliveryRequirement String
    When this subscription should send messages to subscribers relative to messages persistence in storage. Possible values are: DELIVER_IMMEDIATELY, DELIVER_AFTER_STORED, DELIVERY_REQUIREMENT_UNSPECIFIED.

    Import

    Subscription can be imported using any of these accepted formats:

    • projects/{{project}}/locations/{{zone}}/subscriptions/{{name}}

    • {{project}}/{{zone}}/{{name}}

    • {{zone}}/{{name}}

    • {{name}}

    When using the pulumi import command, Subscription can be imported using one of the formats above. For example:

    $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default projects/{{project}}/locations/{{zone}}/subscriptions/{{name}}
    
    $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default {{project}}/{{zone}}/{{name}}
    
    $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default {{zone}}/{{name}}
    
    $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default {{name}}
    

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

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi