/
getTopic.go
78 lines (63 loc) · 2.84 KB
/
getTopic.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1beta2
import (
"context"
"reflect"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Gets the configuration of a topic.
func LookupTopic(ctx *pulumi.Context, args *LookupTopicArgs, opts ...pulumi.InvokeOption) (*LookupTopicResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupTopicResult
err := ctx.Invoke("google-native:pubsub/v1beta2:getTopic", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type LookupTopicArgs struct {
Project *string `pulumi:"project"`
TopicId string `pulumi:"topicId"`
}
type LookupTopicResult struct {
// The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.
Name string `pulumi:"name"`
}
func LookupTopicOutput(ctx *pulumi.Context, args LookupTopicOutputArgs, opts ...pulumi.InvokeOption) LookupTopicResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupTopicResult, error) {
args := v.(LookupTopicArgs)
r, err := LookupTopic(ctx, &args, opts...)
var s LookupTopicResult
if r != nil {
s = *r
}
return s, err
}).(LookupTopicResultOutput)
}
type LookupTopicOutputArgs struct {
Project pulumi.StringPtrInput `pulumi:"project"`
TopicId pulumi.StringInput `pulumi:"topicId"`
}
func (LookupTopicOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupTopicArgs)(nil)).Elem()
}
type LookupTopicResultOutput struct{ *pulumi.OutputState }
func (LookupTopicResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupTopicResult)(nil)).Elem()
}
func (o LookupTopicResultOutput) ToLookupTopicResultOutput() LookupTopicResultOutput {
return o
}
func (o LookupTopicResultOutput) ToLookupTopicResultOutputWithContext(ctx context.Context) LookupTopicResultOutput {
return o
}
// The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.
func (o LookupTopicResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupTopicResult) string { return v.Name }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupTopicResultOutput{})
}