Show / Hide Table of Contents

Class Topic

A named resource to which messages are sent by publishers.

To get more information about Topic, see:

  • API documentation
  • How-to Guides
  • Managing Topics

Example Usage - Pubsub Topic Basic

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var example = new Gcp.PubSub.Topic("example", new Gcp.PubSub.TopicArgs
    {
        Labels = 
        {
            { "foo", "bar" },
        },
    });
}

}

Example Usage - Pubsub Topic Cmek

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var keyRing = new Gcp.Kms.KeyRing("keyRing", new Gcp.Kms.KeyRingArgs
    {
        Location = "global",
    });
    var cryptoKey = new Gcp.Kms.CryptoKey("cryptoKey", new Gcp.Kms.CryptoKeyArgs
    {
        KeyRing = keyRing.Id,
    });
    var example = new Gcp.PubSub.Topic("example", new Gcp.PubSub.TopicArgs
    {
        KmsKeyName = cryptoKey.Id,
    });
}

}

Example Usage - Pubsub Topic Geo Restricted

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var example = new Gcp.PubSub.Topic("example", new Gcp.PubSub.TopicArgs
    {
        MessageStoragePolicy = new Gcp.PubSub.Inputs.TopicMessageStoragePolicyArgs
        {
            AllowedPersistenceRegions = 
            {
                "europe-west3",
            },
        },
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Topic
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.PubSub
Assembly: Pulumi.Gcp.dll
Syntax
public class Topic : CustomResource

Constructors

View Source

Topic(String, TopicArgs, CustomResourceOptions)

Create a Topic resource with the given unique name, arguments, and options.

Declaration
public Topic(string name, TopicArgs args = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

TopicArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

KmsKeyName

The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*

Declaration
public Output<string> KmsKeyName { get; }
Property Value
Type Description
Output<System.String>
View Source

Labels

A set of key/value label pairs to assign to this Topic.

Declaration
public Output<ImmutableDictionary<string, string>> Labels { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>>
View Source

MessageStoragePolicy

Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.

Declaration
public Output<TopicMessageStoragePolicy> MessageStoragePolicy { get; }
Property Value
Type Description
Output<TopicMessageStoragePolicy>
View Source

Name

Name of the topic.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

Project

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Declaration
public Output<string> Project { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, TopicState, CustomResourceOptions)

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

Declaration
public static Topic Get(string name, Input<string> id, TopicState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

TopicState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Topic
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.