-
Notifications
You must be signed in to change notification settings - Fork 50
/
topicIAMBinding.go
146 lines (133 loc) · 7.14 KB
/
topicIAMBinding.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
// nolint: lll
package pubsub
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Three different resources help you manage your IAM policy for Cloud Pub/Sub Topic. Each of these resources serves a different use case:
//
// * `pubsub.TopicIAMPolicy`: Authoritative. Sets the IAM policy for the topic and replaces any existing policy already attached.
// * `pubsub.TopicIAMBinding`: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the topic are preserved.
// * `pubsub.TopicIAMMember`: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the topic are preserved.
//
// > **Note:** `pubsub.TopicIAMPolicy` **cannot** be used in conjunction with `pubsub.TopicIAMBinding` and `pubsub.TopicIAMMember` or they will fight over what your policy should be.
//
// > **Note:** `pubsub.TopicIAMBinding` resources **can be** used in conjunction with `pubsub.TopicIAMMember` resources **only if** they do not grant privilege to the same role.
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-google/blob/master/website/docs/r/pubsub_topic_iam.html.markdown.
type TopicIAMBinding struct {
pulumi.CustomResourceState
Condition TopicIAMBindingConditionPtrOutput `pulumi:"condition"`
// (Computed) The etag of the IAM policy.
Etag pulumi.StringOutput `pulumi:"etag"`
Members pulumi.StringArrayOutput `pulumi:"members"`
// The ID of the project in which the resource belongs.
// If it is not provided, the project will be parsed from the identifier of the parent resource. If no project is provided in the parent identifier and no project is specified, the provider project is used.
Project pulumi.StringOutput `pulumi:"project"`
// The role that should be applied. Only one
// `pubsub.TopicIAMBinding` can be used per role. Note that custom roles must be of the format
// `[projects|organizations]/{parent-name}/roles/{role-name}`.
Role pulumi.StringOutput `pulumi:"role"`
// Used to find the parent resource to bind the IAM policy to
Topic pulumi.StringOutput `pulumi:"topic"`
}
// NewTopicIAMBinding registers a new resource with the given unique name, arguments, and options.
func NewTopicIAMBinding(ctx *pulumi.Context,
name string, args *TopicIAMBindingArgs, opts ...pulumi.ResourceOption) (*TopicIAMBinding, error) {
if args == nil || args.Members == nil {
return nil, errors.New("missing required argument 'Members'")
}
if args == nil || args.Role == nil {
return nil, errors.New("missing required argument 'Role'")
}
if args == nil || args.Topic == nil {
return nil, errors.New("missing required argument 'Topic'")
}
if args == nil {
args = &TopicIAMBindingArgs{}
}
var resource TopicIAMBinding
err := ctx.RegisterResource("gcp:pubsub/topicIAMBinding:TopicIAMBinding", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTopicIAMBinding gets an existing TopicIAMBinding resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetTopicIAMBinding(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TopicIAMBindingState, opts ...pulumi.ResourceOption) (*TopicIAMBinding, error) {
var resource TopicIAMBinding
err := ctx.ReadResource("gcp:pubsub/topicIAMBinding:TopicIAMBinding", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering TopicIAMBinding resources.
type topicIAMBindingState struct {
Condition *TopicIAMBindingCondition `pulumi:"condition"`
// (Computed) The etag of the IAM policy.
Etag *string `pulumi:"etag"`
Members []string `pulumi:"members"`
// The ID of the project in which the resource belongs.
// If it is not provided, the project will be parsed from the identifier of the parent resource. If no project is provided in the parent identifier and no project is specified, the provider project is used.
Project *string `pulumi:"project"`
// The role that should be applied. Only one
// `pubsub.TopicIAMBinding` can be used per role. Note that custom roles must be of the format
// `[projects|organizations]/{parent-name}/roles/{role-name}`.
Role *string `pulumi:"role"`
// Used to find the parent resource to bind the IAM policy to
Topic *string `pulumi:"topic"`
}
type TopicIAMBindingState struct {
Condition TopicIAMBindingConditionPtrInput
// (Computed) The etag of the IAM policy.
Etag pulumi.StringPtrInput
Members pulumi.StringArrayInput
// The ID of the project in which the resource belongs.
// If it is not provided, the project will be parsed from the identifier of the parent resource. If no project is provided in the parent identifier and no project is specified, the provider project is used.
Project pulumi.StringPtrInput
// The role that should be applied. Only one
// `pubsub.TopicIAMBinding` can be used per role. Note that custom roles must be of the format
// `[projects|organizations]/{parent-name}/roles/{role-name}`.
Role pulumi.StringPtrInput
// Used to find the parent resource to bind the IAM policy to
Topic pulumi.StringPtrInput
}
func (TopicIAMBindingState) ElementType() reflect.Type {
return reflect.TypeOf((*topicIAMBindingState)(nil)).Elem()
}
type topicIAMBindingArgs struct {
Condition *TopicIAMBindingCondition `pulumi:"condition"`
Members []string `pulumi:"members"`
// The ID of the project in which the resource belongs.
// If it is not provided, the project will be parsed from the identifier of the parent resource. If no project is provided in the parent identifier and no project is specified, the provider project is used.
Project *string `pulumi:"project"`
// The role that should be applied. Only one
// `pubsub.TopicIAMBinding` can be used per role. Note that custom roles must be of the format
// `[projects|organizations]/{parent-name}/roles/{role-name}`.
Role string `pulumi:"role"`
// Used to find the parent resource to bind the IAM policy to
Topic string `pulumi:"topic"`
}
// The set of arguments for constructing a TopicIAMBinding resource.
type TopicIAMBindingArgs struct {
Condition TopicIAMBindingConditionPtrInput
Members pulumi.StringArrayInput
// The ID of the project in which the resource belongs.
// If it is not provided, the project will be parsed from the identifier of the parent resource. If no project is provided in the parent identifier and no project is specified, the provider project is used.
Project pulumi.StringPtrInput
// The role that should be applied. Only one
// `pubsub.TopicIAMBinding` can be used per role. Note that custom roles must be of the format
// `[projects|organizations]/{parent-name}/roles/{role-name}`.
Role pulumi.StringInput
// Used to find the parent resource to bind the IAM policy to
Topic pulumi.StringInput
}
func (TopicIAMBindingArgs) ElementType() reflect.Type {
return reflect.TypeOf((*topicIAMBindingArgs)(nil)).Elem()
}