/
projectIamMember.go
185 lines (155 loc) · 14 KB
/
projectIamMember.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// 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 v1beta1
import (
"context"
"reflect"
"errors"
iam "github.com/pulumi/pulumi-google-native/sdk/go/google/iam/v1"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Sets the IAM access control policy for the specified Project. CAUTION: This method will replace the existing policy, and cannot be used to append additional IAM settings. NOTE: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted to a `user`, `serviceAccount`, or a group that is part of an organization. For example, group@myownpersonaldomain.com could be added as an owner to a project in the myownpersonaldomain.com organization, but not the examplepetstore.com organization. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + If the project is not part of an organization, there must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. Authorization requires the Google IAM permission `resourcemanager.projects.setIamPolicy` on the project
type ProjectIamMember struct {
pulumi.CustomResourceState
// An IAM Condition for a given binding. See https://cloud.google.com/iam/docs/conditions-overview for additional details.
Condition iam.ConditionPtrOutput `pulumi:"condition"`
// The etag of the resource's IAM policy.
Etag pulumi.StringOutput `pulumi:"etag"`
// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding.
Member pulumi.StringOutput `pulumi:"member"`
// The name of the resource to manage IAM policies for.
Name pulumi.StringOutput `pulumi:"name"`
// The project in which the resource belongs. If it is not provided, a default will be supplied.
Project pulumi.StringOutput `pulumi:"project"`
// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
Role pulumi.StringOutput `pulumi:"role"`
}
// NewProjectIamMember registers a new resource with the given unique name, arguments, and options.
func NewProjectIamMember(ctx *pulumi.Context,
name string, args *ProjectIamMemberArgs, opts ...pulumi.ResourceOption) (*ProjectIamMember, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Member == nil {
return nil, errors.New("invalid value for required argument 'Member'")
}
if args.Name == nil {
return nil, errors.New("invalid value for required argument 'Name'")
}
if args.Role == nil {
return nil, errors.New("invalid value for required argument 'Role'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource ProjectIamMember
err := ctx.RegisterResource("google-native:cloudresourcemanager/v1beta1:ProjectIamMember", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetProjectIamMember gets an existing ProjectIamMember 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 GetProjectIamMember(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ProjectIamMemberState, opts ...pulumi.ResourceOption) (*ProjectIamMember, error) {
var resource ProjectIamMember
err := ctx.ReadResource("google-native:cloudresourcemanager/v1beta1:ProjectIamMember", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ProjectIamMember resources.
type projectIamMemberState struct {
}
type ProjectIamMemberState struct {
}
func (ProjectIamMemberState) ElementType() reflect.Type {
return reflect.TypeOf((*projectIamMemberState)(nil)).Elem()
}
type projectIamMemberArgs struct {
// An IAM Condition for a given binding.
Condition *iam.Condition `pulumi:"condition"`
// Identity that will be granted the privilege in role. The entry can have one of the following values:
//
// * user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
// * serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
// * group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
// * domain:{domain}: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com.
Member string `pulumi:"member"`
// The name of the resource to manage IAM policies for.
Name string `pulumi:"name"`
// The role that should be applied.
Role string `pulumi:"role"`
}
// The set of arguments for constructing a ProjectIamMember resource.
type ProjectIamMemberArgs struct {
// An IAM Condition for a given binding.
Condition iam.ConditionPtrInput
// Identity that will be granted the privilege in role. The entry can have one of the following values:
//
// * user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com.
// * serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com.
// * group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
// * domain:{domain}: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com.
Member pulumi.StringInput
// The name of the resource to manage IAM policies for.
Name pulumi.StringInput
// The role that should be applied.
Role pulumi.StringInput
}
func (ProjectIamMemberArgs) ElementType() reflect.Type {
return reflect.TypeOf((*projectIamMemberArgs)(nil)).Elem()
}
type ProjectIamMemberInput interface {
pulumi.Input
ToProjectIamMemberOutput() ProjectIamMemberOutput
ToProjectIamMemberOutputWithContext(ctx context.Context) ProjectIamMemberOutput
}
func (*ProjectIamMember) ElementType() reflect.Type {
return reflect.TypeOf((**ProjectIamMember)(nil)).Elem()
}
func (i *ProjectIamMember) ToProjectIamMemberOutput() ProjectIamMemberOutput {
return i.ToProjectIamMemberOutputWithContext(context.Background())
}
func (i *ProjectIamMember) ToProjectIamMemberOutputWithContext(ctx context.Context) ProjectIamMemberOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProjectIamMemberOutput)
}
type ProjectIamMemberOutput struct{ *pulumi.OutputState }
func (ProjectIamMemberOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ProjectIamMember)(nil)).Elem()
}
func (o ProjectIamMemberOutput) ToProjectIamMemberOutput() ProjectIamMemberOutput {
return o
}
func (o ProjectIamMemberOutput) ToProjectIamMemberOutputWithContext(ctx context.Context) ProjectIamMemberOutput {
return o
}
// An IAM Condition for a given binding. See https://cloud.google.com/iam/docs/conditions-overview for additional details.
func (o ProjectIamMemberOutput) Condition() iam.ConditionPtrOutput {
return o.ApplyT(func(v *ProjectIamMember) iam.ConditionPtrOutput { return v.Condition }).(iam.ConditionPtrOutput)
}
// The etag of the resource's IAM policy.
func (o ProjectIamMemberOutput) Etag() pulumi.StringOutput {
return o.ApplyT(func(v *ProjectIamMember) pulumi.StringOutput { return v.Etag }).(pulumi.StringOutput)
}
// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding.
func (o ProjectIamMemberOutput) Member() pulumi.StringOutput {
return o.ApplyT(func(v *ProjectIamMember) pulumi.StringOutput { return v.Member }).(pulumi.StringOutput)
}
// The name of the resource to manage IAM policies for.
func (o ProjectIamMemberOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *ProjectIamMember) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The project in which the resource belongs. If it is not provided, a default will be supplied.
func (o ProjectIamMemberOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *ProjectIamMember) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
func (o ProjectIamMemberOutput) Role() pulumi.StringOutput {
return o.ApplyT(func(v *ProjectIamMember) pulumi.StringOutput { return v.Role }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ProjectIamMemberInput)(nil)).Elem(), &ProjectIamMember{})
pulumi.RegisterOutputType(ProjectIamMemberOutput{})
}