github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/grafana/roleAssociation.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package grafana 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides an Amazon Managed Grafana workspace role association resource. 16 // 17 // ## Example Usage 18 // 19 // ### Basic configuration 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "encoding/json" 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/grafana" 30 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 31 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 32 // 33 // ) 34 // 35 // func main() { 36 // pulumi.Run(func(ctx *pulumi.Context) error { 37 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 38 // "Version": "2012-10-17", 39 // "Statement": []map[string]interface{}{ 40 // map[string]interface{}{ 41 // "Action": "sts:AssumeRole", 42 // "Effect": "Allow", 43 // "Sid": "", 44 // "Principal": map[string]interface{}{ 45 // "Service": "grafana.amazonaws.com", 46 // }, 47 // }, 48 // }, 49 // }) 50 // if err != nil { 51 // return err 52 // } 53 // json0 := string(tmpJSON0) 54 // assume, err := iam.NewRole(ctx, "assume", &iam.RoleArgs{ 55 // Name: pulumi.String("grafana-assume"), 56 // AssumeRolePolicy: pulumi.String(json0), 57 // }) 58 // if err != nil { 59 // return err 60 // } 61 // exampleWorkspace, err := grafana.NewWorkspace(ctx, "example", &grafana.WorkspaceArgs{ 62 // AccountAccessType: pulumi.String("CURRENT_ACCOUNT"), 63 // AuthenticationProviders: pulumi.StringArray{ 64 // pulumi.String("SAML"), 65 // }, 66 // PermissionType: pulumi.String("SERVICE_MANAGED"), 67 // RoleArn: assume.Arn, 68 // }) 69 // if err != nil { 70 // return err 71 // } 72 // _, err = grafana.NewRoleAssociation(ctx, "example", &grafana.RoleAssociationArgs{ 73 // Role: pulumi.String("ADMIN"), 74 // UserIds: pulumi.StringArray{ 75 // pulumi.String("USER_ID_1"), 76 // pulumi.String("USER_ID_2"), 77 // }, 78 // WorkspaceId: exampleWorkspace.ID(), 79 // }) 80 // if err != nil { 81 // return err 82 // } 83 // return nil 84 // }) 85 // } 86 // 87 // ``` 88 // <!--End PulumiCodeChooser --> 89 type RoleAssociation struct { 90 pulumi.CustomResourceState 91 92 // The AWS SSO group ids to be assigned the role given in `role`. 93 GroupIds pulumi.StringArrayOutput `pulumi:"groupIds"` 94 // The grafana role. Valid values can be found [here](https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateInstruction.html#ManagedGrafana-Type-UpdateInstruction-role). 95 Role pulumi.StringOutput `pulumi:"role"` 96 // The AWS SSO user ids to be assigned the role given in `role`. 97 UserIds pulumi.StringArrayOutput `pulumi:"userIds"` 98 // The workspace id. 99 // 100 // The following arguments are optional: 101 WorkspaceId pulumi.StringOutput `pulumi:"workspaceId"` 102 } 103 104 // NewRoleAssociation registers a new resource with the given unique name, arguments, and options. 105 func NewRoleAssociation(ctx *pulumi.Context, 106 name string, args *RoleAssociationArgs, opts ...pulumi.ResourceOption) (*RoleAssociation, error) { 107 if args == nil { 108 return nil, errors.New("missing one or more required arguments") 109 } 110 111 if args.Role == nil { 112 return nil, errors.New("invalid value for required argument 'Role'") 113 } 114 if args.WorkspaceId == nil { 115 return nil, errors.New("invalid value for required argument 'WorkspaceId'") 116 } 117 opts = internal.PkgResourceDefaultOpts(opts) 118 var resource RoleAssociation 119 err := ctx.RegisterResource("aws:grafana/roleAssociation:RoleAssociation", name, args, &resource, opts...) 120 if err != nil { 121 return nil, err 122 } 123 return &resource, nil 124 } 125 126 // GetRoleAssociation gets an existing RoleAssociation resource's state with the given name, ID, and optional 127 // state properties that are used to uniquely qualify the lookup (nil if not required). 128 func GetRoleAssociation(ctx *pulumi.Context, 129 name string, id pulumi.IDInput, state *RoleAssociationState, opts ...pulumi.ResourceOption) (*RoleAssociation, error) { 130 var resource RoleAssociation 131 err := ctx.ReadResource("aws:grafana/roleAssociation:RoleAssociation", name, id, state, &resource, opts...) 132 if err != nil { 133 return nil, err 134 } 135 return &resource, nil 136 } 137 138 // Input properties used for looking up and filtering RoleAssociation resources. 139 type roleAssociationState struct { 140 // The AWS SSO group ids to be assigned the role given in `role`. 141 GroupIds []string `pulumi:"groupIds"` 142 // The grafana role. Valid values can be found [here](https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateInstruction.html#ManagedGrafana-Type-UpdateInstruction-role). 143 Role *string `pulumi:"role"` 144 // The AWS SSO user ids to be assigned the role given in `role`. 145 UserIds []string `pulumi:"userIds"` 146 // The workspace id. 147 // 148 // The following arguments are optional: 149 WorkspaceId *string `pulumi:"workspaceId"` 150 } 151 152 type RoleAssociationState struct { 153 // The AWS SSO group ids to be assigned the role given in `role`. 154 GroupIds pulumi.StringArrayInput 155 // The grafana role. Valid values can be found [here](https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateInstruction.html#ManagedGrafana-Type-UpdateInstruction-role). 156 Role pulumi.StringPtrInput 157 // The AWS SSO user ids to be assigned the role given in `role`. 158 UserIds pulumi.StringArrayInput 159 // The workspace id. 160 // 161 // The following arguments are optional: 162 WorkspaceId pulumi.StringPtrInput 163 } 164 165 func (RoleAssociationState) ElementType() reflect.Type { 166 return reflect.TypeOf((*roleAssociationState)(nil)).Elem() 167 } 168 169 type roleAssociationArgs struct { 170 // The AWS SSO group ids to be assigned the role given in `role`. 171 GroupIds []string `pulumi:"groupIds"` 172 // The grafana role. Valid values can be found [here](https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateInstruction.html#ManagedGrafana-Type-UpdateInstruction-role). 173 Role string `pulumi:"role"` 174 // The AWS SSO user ids to be assigned the role given in `role`. 175 UserIds []string `pulumi:"userIds"` 176 // The workspace id. 177 // 178 // The following arguments are optional: 179 WorkspaceId string `pulumi:"workspaceId"` 180 } 181 182 // The set of arguments for constructing a RoleAssociation resource. 183 type RoleAssociationArgs struct { 184 // The AWS SSO group ids to be assigned the role given in `role`. 185 GroupIds pulumi.StringArrayInput 186 // The grafana role. Valid values can be found [here](https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateInstruction.html#ManagedGrafana-Type-UpdateInstruction-role). 187 Role pulumi.StringInput 188 // The AWS SSO user ids to be assigned the role given in `role`. 189 UserIds pulumi.StringArrayInput 190 // The workspace id. 191 // 192 // The following arguments are optional: 193 WorkspaceId pulumi.StringInput 194 } 195 196 func (RoleAssociationArgs) ElementType() reflect.Type { 197 return reflect.TypeOf((*roleAssociationArgs)(nil)).Elem() 198 } 199 200 type RoleAssociationInput interface { 201 pulumi.Input 202 203 ToRoleAssociationOutput() RoleAssociationOutput 204 ToRoleAssociationOutputWithContext(ctx context.Context) RoleAssociationOutput 205 } 206 207 func (*RoleAssociation) ElementType() reflect.Type { 208 return reflect.TypeOf((**RoleAssociation)(nil)).Elem() 209 } 210 211 func (i *RoleAssociation) ToRoleAssociationOutput() RoleAssociationOutput { 212 return i.ToRoleAssociationOutputWithContext(context.Background()) 213 } 214 215 func (i *RoleAssociation) ToRoleAssociationOutputWithContext(ctx context.Context) RoleAssociationOutput { 216 return pulumi.ToOutputWithContext(ctx, i).(RoleAssociationOutput) 217 } 218 219 // RoleAssociationArrayInput is an input type that accepts RoleAssociationArray and RoleAssociationArrayOutput values. 220 // You can construct a concrete instance of `RoleAssociationArrayInput` via: 221 // 222 // RoleAssociationArray{ RoleAssociationArgs{...} } 223 type RoleAssociationArrayInput interface { 224 pulumi.Input 225 226 ToRoleAssociationArrayOutput() RoleAssociationArrayOutput 227 ToRoleAssociationArrayOutputWithContext(context.Context) RoleAssociationArrayOutput 228 } 229 230 type RoleAssociationArray []RoleAssociationInput 231 232 func (RoleAssociationArray) ElementType() reflect.Type { 233 return reflect.TypeOf((*[]*RoleAssociation)(nil)).Elem() 234 } 235 236 func (i RoleAssociationArray) ToRoleAssociationArrayOutput() RoleAssociationArrayOutput { 237 return i.ToRoleAssociationArrayOutputWithContext(context.Background()) 238 } 239 240 func (i RoleAssociationArray) ToRoleAssociationArrayOutputWithContext(ctx context.Context) RoleAssociationArrayOutput { 241 return pulumi.ToOutputWithContext(ctx, i).(RoleAssociationArrayOutput) 242 } 243 244 // RoleAssociationMapInput is an input type that accepts RoleAssociationMap and RoleAssociationMapOutput values. 245 // You can construct a concrete instance of `RoleAssociationMapInput` via: 246 // 247 // RoleAssociationMap{ "key": RoleAssociationArgs{...} } 248 type RoleAssociationMapInput interface { 249 pulumi.Input 250 251 ToRoleAssociationMapOutput() RoleAssociationMapOutput 252 ToRoleAssociationMapOutputWithContext(context.Context) RoleAssociationMapOutput 253 } 254 255 type RoleAssociationMap map[string]RoleAssociationInput 256 257 func (RoleAssociationMap) ElementType() reflect.Type { 258 return reflect.TypeOf((*map[string]*RoleAssociation)(nil)).Elem() 259 } 260 261 func (i RoleAssociationMap) ToRoleAssociationMapOutput() RoleAssociationMapOutput { 262 return i.ToRoleAssociationMapOutputWithContext(context.Background()) 263 } 264 265 func (i RoleAssociationMap) ToRoleAssociationMapOutputWithContext(ctx context.Context) RoleAssociationMapOutput { 266 return pulumi.ToOutputWithContext(ctx, i).(RoleAssociationMapOutput) 267 } 268 269 type RoleAssociationOutput struct{ *pulumi.OutputState } 270 271 func (RoleAssociationOutput) ElementType() reflect.Type { 272 return reflect.TypeOf((**RoleAssociation)(nil)).Elem() 273 } 274 275 func (o RoleAssociationOutput) ToRoleAssociationOutput() RoleAssociationOutput { 276 return o 277 } 278 279 func (o RoleAssociationOutput) ToRoleAssociationOutputWithContext(ctx context.Context) RoleAssociationOutput { 280 return o 281 } 282 283 // The AWS SSO group ids to be assigned the role given in `role`. 284 func (o RoleAssociationOutput) GroupIds() pulumi.StringArrayOutput { 285 return o.ApplyT(func(v *RoleAssociation) pulumi.StringArrayOutput { return v.GroupIds }).(pulumi.StringArrayOutput) 286 } 287 288 // The grafana role. Valid values can be found [here](https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateInstruction.html#ManagedGrafana-Type-UpdateInstruction-role). 289 func (o RoleAssociationOutput) Role() pulumi.StringOutput { 290 return o.ApplyT(func(v *RoleAssociation) pulumi.StringOutput { return v.Role }).(pulumi.StringOutput) 291 } 292 293 // The AWS SSO user ids to be assigned the role given in `role`. 294 func (o RoleAssociationOutput) UserIds() pulumi.StringArrayOutput { 295 return o.ApplyT(func(v *RoleAssociation) pulumi.StringArrayOutput { return v.UserIds }).(pulumi.StringArrayOutput) 296 } 297 298 // The workspace id. 299 // 300 // The following arguments are optional: 301 func (o RoleAssociationOutput) WorkspaceId() pulumi.StringOutput { 302 return o.ApplyT(func(v *RoleAssociation) pulumi.StringOutput { return v.WorkspaceId }).(pulumi.StringOutput) 303 } 304 305 type RoleAssociationArrayOutput struct{ *pulumi.OutputState } 306 307 func (RoleAssociationArrayOutput) ElementType() reflect.Type { 308 return reflect.TypeOf((*[]*RoleAssociation)(nil)).Elem() 309 } 310 311 func (o RoleAssociationArrayOutput) ToRoleAssociationArrayOutput() RoleAssociationArrayOutput { 312 return o 313 } 314 315 func (o RoleAssociationArrayOutput) ToRoleAssociationArrayOutputWithContext(ctx context.Context) RoleAssociationArrayOutput { 316 return o 317 } 318 319 func (o RoleAssociationArrayOutput) Index(i pulumi.IntInput) RoleAssociationOutput { 320 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RoleAssociation { 321 return vs[0].([]*RoleAssociation)[vs[1].(int)] 322 }).(RoleAssociationOutput) 323 } 324 325 type RoleAssociationMapOutput struct{ *pulumi.OutputState } 326 327 func (RoleAssociationMapOutput) ElementType() reflect.Type { 328 return reflect.TypeOf((*map[string]*RoleAssociation)(nil)).Elem() 329 } 330 331 func (o RoleAssociationMapOutput) ToRoleAssociationMapOutput() RoleAssociationMapOutput { 332 return o 333 } 334 335 func (o RoleAssociationMapOutput) ToRoleAssociationMapOutputWithContext(ctx context.Context) RoleAssociationMapOutput { 336 return o 337 } 338 339 func (o RoleAssociationMapOutput) MapIndex(k pulumi.StringInput) RoleAssociationOutput { 340 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RoleAssociation { 341 return vs[0].(map[string]*RoleAssociation)[vs[1].(string)] 342 }).(RoleAssociationOutput) 343 } 344 345 func init() { 346 pulumi.RegisterInputType(reflect.TypeOf((*RoleAssociationInput)(nil)).Elem(), &RoleAssociation{}) 347 pulumi.RegisterInputType(reflect.TypeOf((*RoleAssociationArrayInput)(nil)).Elem(), RoleAssociationArray{}) 348 pulumi.RegisterInputType(reflect.TypeOf((*RoleAssociationMapInput)(nil)).Elem(), RoleAssociationMap{}) 349 pulumi.RegisterOutputType(RoleAssociationOutput{}) 350 pulumi.RegisterOutputType(RoleAssociationArrayOutput{}) 351 pulumi.RegisterOutputType(RoleAssociationMapOutput{}) 352 }