-
Notifications
You must be signed in to change notification settings - Fork 51
/
subscriptionIAMMember.go
146 lines (133 loc) · 6.76 KB
/
subscriptionIAMMember.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 pubsub subscription. Each of these resources serves a different use case:
//
// * `pubsub.SubscriptionIAMPolicy`: Authoritative. Sets the IAM policy for the subscription and replaces any existing policy already attached.
// * `pubsub.SubscriptionIAMBinding`: 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 subscription are preserved.
// * `pubsub.SubscriptionIAMMember`: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the subscription are preserved.
//
// > **Note:** `pubsub.SubscriptionIAMPolicy` **cannot** be used in conjunction with `pubsub.SubscriptionIAMBinding` and `pubsub.SubscriptionIAMMember` or they will fight over what your policy should be.
//
// > **Note:** `pubsub.SubscriptionIAMBinding` resources **can be** used in conjunction with `pubsub.SubscriptionIAMMember` 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_subscription_iam.html.markdown.
type SubscriptionIAMMember struct {
pulumi.CustomResourceState
Condition SubscriptionIAMMemberConditionPtrOutput `pulumi:"condition"`
// (Computed) The etag of the subscription's IAM policy.
Etag pulumi.StringOutput `pulumi:"etag"`
Member pulumi.StringOutput `pulumi:"member"`
// The project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringOutput `pulumi:"project"`
// The role that should be applied. Only one
// `pubsub.SubscriptionIAMBinding` 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"`
// The subscription name or id to bind to attach IAM policy to.
Subscription pulumi.StringOutput `pulumi:"subscription"`
}
// NewSubscriptionIAMMember registers a new resource with the given unique name, arguments, and options.
func NewSubscriptionIAMMember(ctx *pulumi.Context,
name string, args *SubscriptionIAMMemberArgs, opts ...pulumi.ResourceOption) (*SubscriptionIAMMember, error) {
if args == nil || args.Member == nil {
return nil, errors.New("missing required argument 'Member'")
}
if args == nil || args.Role == nil {
return nil, errors.New("missing required argument 'Role'")
}
if args == nil || args.Subscription == nil {
return nil, errors.New("missing required argument 'Subscription'")
}
if args == nil {
args = &SubscriptionIAMMemberArgs{}
}
var resource SubscriptionIAMMember
err := ctx.RegisterResource("gcp:pubsub/subscriptionIAMMember:SubscriptionIAMMember", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSubscriptionIAMMember gets an existing SubscriptionIAMMember 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 GetSubscriptionIAMMember(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SubscriptionIAMMemberState, opts ...pulumi.ResourceOption) (*SubscriptionIAMMember, error) {
var resource SubscriptionIAMMember
err := ctx.ReadResource("gcp:pubsub/subscriptionIAMMember:SubscriptionIAMMember", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SubscriptionIAMMember resources.
type subscriptionIAMMemberState struct {
Condition *SubscriptionIAMMemberCondition `pulumi:"condition"`
// (Computed) The etag of the subscription's IAM policy.
Etag *string `pulumi:"etag"`
Member *string `pulumi:"member"`
// The project in which the resource belongs. If it
// is not provided, the provider project is used.
Project *string `pulumi:"project"`
// The role that should be applied. Only one
// `pubsub.SubscriptionIAMBinding` 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"`
// The subscription name or id to bind to attach IAM policy to.
Subscription *string `pulumi:"subscription"`
}
type SubscriptionIAMMemberState struct {
Condition SubscriptionIAMMemberConditionPtrInput
// (Computed) The etag of the subscription's IAM policy.
Etag pulumi.StringPtrInput
Member pulumi.StringPtrInput
// The project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringPtrInput
// The role that should be applied. Only one
// `pubsub.SubscriptionIAMBinding` can be used per role. Note that custom roles must be of the format
// `[projects|organizations]/{parent-name}/roles/{role-name}`.
Role pulumi.StringPtrInput
// The subscription name or id to bind to attach IAM policy to.
Subscription pulumi.StringPtrInput
}
func (SubscriptionIAMMemberState) ElementType() reflect.Type {
return reflect.TypeOf((*subscriptionIAMMemberState)(nil)).Elem()
}
type subscriptionIAMMemberArgs struct {
Condition *SubscriptionIAMMemberCondition `pulumi:"condition"`
Member string `pulumi:"member"`
// The project in which the resource belongs. If it
// is not provided, the provider project is used.
Project *string `pulumi:"project"`
// The role that should be applied. Only one
// `pubsub.SubscriptionIAMBinding` 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"`
// The subscription name or id to bind to attach IAM policy to.
Subscription string `pulumi:"subscription"`
}
// The set of arguments for constructing a SubscriptionIAMMember resource.
type SubscriptionIAMMemberArgs struct {
Condition SubscriptionIAMMemberConditionPtrInput
Member pulumi.StringInput
// The project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringPtrInput
// The role that should be applied. Only one
// `pubsub.SubscriptionIAMBinding` can be used per role. Note that custom roles must be of the format
// `[projects|organizations]/{parent-name}/roles/{role-name}`.
Role pulumi.StringInput
// The subscription name or id to bind to attach IAM policy to.
Subscription pulumi.StringInput
}
func (SubscriptionIAMMemberArgs) ElementType() reflect.Type {
return reflect.TypeOf((*subscriptionIAMMemberArgs)(nil)).Elem()
}