generated from pulumi/pulumi-tf-provider-boilerplate
/
getRole.go
208 lines (182 loc) · 7.17 KB
/
getRole.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package grafana
import (
"context"
"reflect"
"github.com/lbrlabs/pulumi-grafana/sdk/go/grafana/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// **Note:** This resource is available only with Grafana Enterprise 8.+.
//
// * [Official documentation](https://grafana.com/docs/grafana/latest/administration/roles-and-permissions/access-control/)
// * [HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/access_control/)
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/lbrlabs/pulumi-grafana/sdk/go/grafana"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// test, err := grafana.NewRole(ctx, "test", &grafana.RoleArgs{
// Description: pulumi.String("test-role description"),
// Uid: pulumi.String("test-ds-role-uid"),
// Version: pulumi.Int(1),
// Global: pulumi.Bool(true),
// Permissions: grafana.RolePermissionArray{
// &grafana.RolePermissionArgs{
// Action: pulumi.String("org.users:add"),
// Scope: pulumi.String("users:*"),
// },
// &grafana.RolePermissionArgs{
// Action: pulumi.String("org.users:write"),
// Scope: pulumi.String("users:*"),
// },
// &grafana.RolePermissionArgs{
// Action: pulumi.String("org.users:read"),
// Scope: pulumi.String("users:*"),
// },
// },
// })
// if err != nil {
// return err
// }
// _ = grafana.LookupRoleOutput(ctx, grafana.GetRoleOutputArgs{
// Name: test.Name,
// }, nil)
// return nil
// })
// }
//
// ```
func LookupRole(ctx *pulumi.Context, args *LookupRoleArgs, opts ...pulumi.InvokeOption) (*LookupRoleResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupRoleResult
err := ctx.Invoke("grafana:index/getRole:getRole", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getRole.
type LookupRoleArgs struct {
// Name of the role
Name string `pulumi:"name"`
}
// A collection of values returned by getRole.
type LookupRoleResult struct {
// Description of the role.
Description string `pulumi:"description"`
// Display name of the role. Available with Grafana 8.5+.
DisplayName string `pulumi:"displayName"`
// Boolean to state whether the role is available across all organizations or not.
Global bool `pulumi:"global"`
// Group of the role. Available with Grafana 8.5+.
Group string `pulumi:"group"`
// Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+.
Hidden bool `pulumi:"hidden"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// Name of the role
Name string `pulumi:"name"`
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
OrgId string `pulumi:"orgId"`
// Specific set of actions granted by the role.
Permissions []GetRolePermission `pulumi:"permissions"`
// Unique identifier of the role. Used for assignments.
Uid string `pulumi:"uid"`
// Version of the role. A role is updated only on version increase. This field or `autoIncrementVersion` should be set.
Version int `pulumi:"version"`
}
func LookupRoleOutput(ctx *pulumi.Context, args LookupRoleOutputArgs, opts ...pulumi.InvokeOption) LookupRoleResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupRoleResult, error) {
args := v.(LookupRoleArgs)
r, err := LookupRole(ctx, &args, opts...)
var s LookupRoleResult
if r != nil {
s = *r
}
return s, err
}).(LookupRoleResultOutput)
}
// A collection of arguments for invoking getRole.
type LookupRoleOutputArgs struct {
// Name of the role
Name pulumi.StringInput `pulumi:"name"`
}
func (LookupRoleOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupRoleArgs)(nil)).Elem()
}
// A collection of values returned by getRole.
type LookupRoleResultOutput struct{ *pulumi.OutputState }
func (LookupRoleResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupRoleResult)(nil)).Elem()
}
func (o LookupRoleResultOutput) ToLookupRoleResultOutput() LookupRoleResultOutput {
return o
}
func (o LookupRoleResultOutput) ToLookupRoleResultOutputWithContext(ctx context.Context) LookupRoleResultOutput {
return o
}
func (o LookupRoleResultOutput) ToOutput(ctx context.Context) pulumix.Output[LookupRoleResult] {
return pulumix.Output[LookupRoleResult]{
OutputState: o.OutputState,
}
}
// Description of the role.
func (o LookupRoleResultOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v LookupRoleResult) string { return v.Description }).(pulumi.StringOutput)
}
// Display name of the role. Available with Grafana 8.5+.
func (o LookupRoleResultOutput) DisplayName() pulumi.StringOutput {
return o.ApplyT(func(v LookupRoleResult) string { return v.DisplayName }).(pulumi.StringOutput)
}
// Boolean to state whether the role is available across all organizations or not.
func (o LookupRoleResultOutput) Global() pulumi.BoolOutput {
return o.ApplyT(func(v LookupRoleResult) bool { return v.Global }).(pulumi.BoolOutput)
}
// Group of the role. Available with Grafana 8.5+.
func (o LookupRoleResultOutput) Group() pulumi.StringOutput {
return o.ApplyT(func(v LookupRoleResult) string { return v.Group }).(pulumi.StringOutput)
}
// Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+.
func (o LookupRoleResultOutput) Hidden() pulumi.BoolOutput {
return o.ApplyT(func(v LookupRoleResult) bool { return v.Hidden }).(pulumi.BoolOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupRoleResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupRoleResult) string { return v.Id }).(pulumi.StringOutput)
}
// Name of the role
func (o LookupRoleResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupRoleResult) string { return v.Name }).(pulumi.StringOutput)
}
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
func (o LookupRoleResultOutput) OrgId() pulumi.StringOutput {
return o.ApplyT(func(v LookupRoleResult) string { return v.OrgId }).(pulumi.StringOutput)
}
// Specific set of actions granted by the role.
func (o LookupRoleResultOutput) Permissions() GetRolePermissionArrayOutput {
return o.ApplyT(func(v LookupRoleResult) []GetRolePermission { return v.Permissions }).(GetRolePermissionArrayOutput)
}
// Unique identifier of the role. Used for assignments.
func (o LookupRoleResultOutput) Uid() pulumi.StringOutput {
return o.ApplyT(func(v LookupRoleResult) string { return v.Uid }).(pulumi.StringOutput)
}
// Version of the role. A role is updated only on version increase. This field or `autoIncrementVersion` should be set.
func (o LookupRoleResultOutput) Version() pulumi.IntOutput {
return o.ApplyT(func(v LookupRoleResult) int { return v.Version }).(pulumi.IntOutput)
}
func init() {
pulumi.RegisterOutputType(LookupRoleResultOutput{})
}