-
Notifications
You must be signed in to change notification settings - Fork 8
/
roleAssignment.go
165 lines (152 loc) · 4.97 KB
/
roleAssignment.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
// *** 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! ***
package identity
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Manages a V3 Role assignment within OpenStack Keystone.
//
// Note: You _must_ have admin privileges in your OpenStack cloud to use
// this resource.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-openstack/sdk/v2/go/openstack/identity"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// project1, err := identity.NewProject(ctx, "project1", nil)
// if err != nil {
// return err
// }
// user1, err := identity.NewUser(ctx, "user1", &identity.UserArgs{
// DefaultProjectId: project1.ID(),
// })
// if err != nil {
// return err
// }
// role1, err := identity.NewRole(ctx, "role1", nil)
// if err != nil {
// return err
// }
// _, err = identity.NewRoleAssignment(ctx, "roleAssignment1", &identity.RoleAssignmentArgs{
// ProjectId: project1.ID(),
// RoleId: role1.ID(),
// UserId: user1.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type RoleAssignment struct {
pulumi.CustomResourceState
// The domain to assign the role in.
DomainId pulumi.StringPtrOutput `pulumi:"domainId"`
// The group to assign the role to.
GroupId pulumi.StringPtrOutput `pulumi:"groupId"`
// The project to assign the role in.
ProjectId pulumi.StringPtrOutput `pulumi:"projectId"`
Region pulumi.StringOutput `pulumi:"region"`
// The role to assign.
RoleId pulumi.StringOutput `pulumi:"roleId"`
// The user to assign the role to.
UserId pulumi.StringPtrOutput `pulumi:"userId"`
}
// NewRoleAssignment registers a new resource with the given unique name, arguments, and options.
func NewRoleAssignment(ctx *pulumi.Context,
name string, args *RoleAssignmentArgs, opts ...pulumi.ResourceOption) (*RoleAssignment, error) {
if args == nil || args.RoleId == nil {
return nil, errors.New("missing required argument 'RoleId'")
}
if args == nil {
args = &RoleAssignmentArgs{}
}
var resource RoleAssignment
err := ctx.RegisterResource("openstack:identity/roleAssignment:RoleAssignment", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetRoleAssignment gets an existing RoleAssignment 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 GetRoleAssignment(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *RoleAssignmentState, opts ...pulumi.ResourceOption) (*RoleAssignment, error) {
var resource RoleAssignment
err := ctx.ReadResource("openstack:identity/roleAssignment:RoleAssignment", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering RoleAssignment resources.
type roleAssignmentState struct {
// The domain to assign the role in.
DomainId *string `pulumi:"domainId"`
// The group to assign the role to.
GroupId *string `pulumi:"groupId"`
// The project to assign the role in.
ProjectId *string `pulumi:"projectId"`
Region *string `pulumi:"region"`
// The role to assign.
RoleId *string `pulumi:"roleId"`
// The user to assign the role to.
UserId *string `pulumi:"userId"`
}
type RoleAssignmentState struct {
// The domain to assign the role in.
DomainId pulumi.StringPtrInput
// The group to assign the role to.
GroupId pulumi.StringPtrInput
// The project to assign the role in.
ProjectId pulumi.StringPtrInput
Region pulumi.StringPtrInput
// The role to assign.
RoleId pulumi.StringPtrInput
// The user to assign the role to.
UserId pulumi.StringPtrInput
}
func (RoleAssignmentState) ElementType() reflect.Type {
return reflect.TypeOf((*roleAssignmentState)(nil)).Elem()
}
type roleAssignmentArgs struct {
// The domain to assign the role in.
DomainId *string `pulumi:"domainId"`
// The group to assign the role to.
GroupId *string `pulumi:"groupId"`
// The project to assign the role in.
ProjectId *string `pulumi:"projectId"`
Region *string `pulumi:"region"`
// The role to assign.
RoleId string `pulumi:"roleId"`
// The user to assign the role to.
UserId *string `pulumi:"userId"`
}
// The set of arguments for constructing a RoleAssignment resource.
type RoleAssignmentArgs struct {
// The domain to assign the role in.
DomainId pulumi.StringPtrInput
// The group to assign the role to.
GroupId pulumi.StringPtrInput
// The project to assign the role in.
ProjectId pulumi.StringPtrInput
Region pulumi.StringPtrInput
// The role to assign.
RoleId pulumi.StringInput
// The user to assign the role to.
UserId pulumi.StringPtrInput
}
func (RoleAssignmentArgs) ElementType() reflect.Type {
return reflect.TypeOf((*roleAssignmentArgs)(nil)).Elem()
}