github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/grafana/licenseAssociation.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 license 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.NewLicenseAssociation(ctx, "example", &grafana.LicenseAssociationArgs{ 73 // LicenseType: pulumi.String("ENTERPRISE_FREE_TRIAL"), 74 // WorkspaceId: exampleWorkspace.ID(), 75 // }) 76 // if err != nil { 77 // return err 78 // } 79 // return nil 80 // }) 81 // } 82 // 83 // ``` 84 // <!--End PulumiCodeChooser --> 85 // 86 // ## Import 87 // 88 // Using `pulumi import`, import Grafana workspace license association using the workspace's `id`. For example: 89 // 90 // ```sh 91 // $ pulumi import aws:grafana/licenseAssociation:LicenseAssociation example g-2054c75a02 92 // ``` 93 type LicenseAssociation struct { 94 pulumi.CustomResourceState 95 96 // If `licenseType` is set to `ENTERPRISE_FREE_TRIAL`, this is the expiration date of the free trial. 97 FreeTrialExpiration pulumi.StringOutput `pulumi:"freeTrialExpiration"` 98 // If `licenseType` is set to `ENTERPRISE`, this is the expiration date of the enterprise license. 99 LicenseExpiration pulumi.StringOutput `pulumi:"licenseExpiration"` 100 // The type of license for the workspace license association. Valid values are `ENTERPRISE` and `ENTERPRISE_FREE_TRIAL`. 101 LicenseType pulumi.StringOutput `pulumi:"licenseType"` 102 // The workspace id. 103 WorkspaceId pulumi.StringOutput `pulumi:"workspaceId"` 104 } 105 106 // NewLicenseAssociation registers a new resource with the given unique name, arguments, and options. 107 func NewLicenseAssociation(ctx *pulumi.Context, 108 name string, args *LicenseAssociationArgs, opts ...pulumi.ResourceOption) (*LicenseAssociation, error) { 109 if args == nil { 110 return nil, errors.New("missing one or more required arguments") 111 } 112 113 if args.LicenseType == nil { 114 return nil, errors.New("invalid value for required argument 'LicenseType'") 115 } 116 if args.WorkspaceId == nil { 117 return nil, errors.New("invalid value for required argument 'WorkspaceId'") 118 } 119 opts = internal.PkgResourceDefaultOpts(opts) 120 var resource LicenseAssociation 121 err := ctx.RegisterResource("aws:grafana/licenseAssociation:LicenseAssociation", name, args, &resource, opts...) 122 if err != nil { 123 return nil, err 124 } 125 return &resource, nil 126 } 127 128 // GetLicenseAssociation gets an existing LicenseAssociation resource's state with the given name, ID, and optional 129 // state properties that are used to uniquely qualify the lookup (nil if not required). 130 func GetLicenseAssociation(ctx *pulumi.Context, 131 name string, id pulumi.IDInput, state *LicenseAssociationState, opts ...pulumi.ResourceOption) (*LicenseAssociation, error) { 132 var resource LicenseAssociation 133 err := ctx.ReadResource("aws:grafana/licenseAssociation:LicenseAssociation", name, id, state, &resource, opts...) 134 if err != nil { 135 return nil, err 136 } 137 return &resource, nil 138 } 139 140 // Input properties used for looking up and filtering LicenseAssociation resources. 141 type licenseAssociationState struct { 142 // If `licenseType` is set to `ENTERPRISE_FREE_TRIAL`, this is the expiration date of the free trial. 143 FreeTrialExpiration *string `pulumi:"freeTrialExpiration"` 144 // If `licenseType` is set to `ENTERPRISE`, this is the expiration date of the enterprise license. 145 LicenseExpiration *string `pulumi:"licenseExpiration"` 146 // The type of license for the workspace license association. Valid values are `ENTERPRISE` and `ENTERPRISE_FREE_TRIAL`. 147 LicenseType *string `pulumi:"licenseType"` 148 // The workspace id. 149 WorkspaceId *string `pulumi:"workspaceId"` 150 } 151 152 type LicenseAssociationState struct { 153 // If `licenseType` is set to `ENTERPRISE_FREE_TRIAL`, this is the expiration date of the free trial. 154 FreeTrialExpiration pulumi.StringPtrInput 155 // If `licenseType` is set to `ENTERPRISE`, this is the expiration date of the enterprise license. 156 LicenseExpiration pulumi.StringPtrInput 157 // The type of license for the workspace license association. Valid values are `ENTERPRISE` and `ENTERPRISE_FREE_TRIAL`. 158 LicenseType pulumi.StringPtrInput 159 // The workspace id. 160 WorkspaceId pulumi.StringPtrInput 161 } 162 163 func (LicenseAssociationState) ElementType() reflect.Type { 164 return reflect.TypeOf((*licenseAssociationState)(nil)).Elem() 165 } 166 167 type licenseAssociationArgs struct { 168 // The type of license for the workspace license association. Valid values are `ENTERPRISE` and `ENTERPRISE_FREE_TRIAL`. 169 LicenseType string `pulumi:"licenseType"` 170 // The workspace id. 171 WorkspaceId string `pulumi:"workspaceId"` 172 } 173 174 // The set of arguments for constructing a LicenseAssociation resource. 175 type LicenseAssociationArgs struct { 176 // The type of license for the workspace license association. Valid values are `ENTERPRISE` and `ENTERPRISE_FREE_TRIAL`. 177 LicenseType pulumi.StringInput 178 // The workspace id. 179 WorkspaceId pulumi.StringInput 180 } 181 182 func (LicenseAssociationArgs) ElementType() reflect.Type { 183 return reflect.TypeOf((*licenseAssociationArgs)(nil)).Elem() 184 } 185 186 type LicenseAssociationInput interface { 187 pulumi.Input 188 189 ToLicenseAssociationOutput() LicenseAssociationOutput 190 ToLicenseAssociationOutputWithContext(ctx context.Context) LicenseAssociationOutput 191 } 192 193 func (*LicenseAssociation) ElementType() reflect.Type { 194 return reflect.TypeOf((**LicenseAssociation)(nil)).Elem() 195 } 196 197 func (i *LicenseAssociation) ToLicenseAssociationOutput() LicenseAssociationOutput { 198 return i.ToLicenseAssociationOutputWithContext(context.Background()) 199 } 200 201 func (i *LicenseAssociation) ToLicenseAssociationOutputWithContext(ctx context.Context) LicenseAssociationOutput { 202 return pulumi.ToOutputWithContext(ctx, i).(LicenseAssociationOutput) 203 } 204 205 // LicenseAssociationArrayInput is an input type that accepts LicenseAssociationArray and LicenseAssociationArrayOutput values. 206 // You can construct a concrete instance of `LicenseAssociationArrayInput` via: 207 // 208 // LicenseAssociationArray{ LicenseAssociationArgs{...} } 209 type LicenseAssociationArrayInput interface { 210 pulumi.Input 211 212 ToLicenseAssociationArrayOutput() LicenseAssociationArrayOutput 213 ToLicenseAssociationArrayOutputWithContext(context.Context) LicenseAssociationArrayOutput 214 } 215 216 type LicenseAssociationArray []LicenseAssociationInput 217 218 func (LicenseAssociationArray) ElementType() reflect.Type { 219 return reflect.TypeOf((*[]*LicenseAssociation)(nil)).Elem() 220 } 221 222 func (i LicenseAssociationArray) ToLicenseAssociationArrayOutput() LicenseAssociationArrayOutput { 223 return i.ToLicenseAssociationArrayOutputWithContext(context.Background()) 224 } 225 226 func (i LicenseAssociationArray) ToLicenseAssociationArrayOutputWithContext(ctx context.Context) LicenseAssociationArrayOutput { 227 return pulumi.ToOutputWithContext(ctx, i).(LicenseAssociationArrayOutput) 228 } 229 230 // LicenseAssociationMapInput is an input type that accepts LicenseAssociationMap and LicenseAssociationMapOutput values. 231 // You can construct a concrete instance of `LicenseAssociationMapInput` via: 232 // 233 // LicenseAssociationMap{ "key": LicenseAssociationArgs{...} } 234 type LicenseAssociationMapInput interface { 235 pulumi.Input 236 237 ToLicenseAssociationMapOutput() LicenseAssociationMapOutput 238 ToLicenseAssociationMapOutputWithContext(context.Context) LicenseAssociationMapOutput 239 } 240 241 type LicenseAssociationMap map[string]LicenseAssociationInput 242 243 func (LicenseAssociationMap) ElementType() reflect.Type { 244 return reflect.TypeOf((*map[string]*LicenseAssociation)(nil)).Elem() 245 } 246 247 func (i LicenseAssociationMap) ToLicenseAssociationMapOutput() LicenseAssociationMapOutput { 248 return i.ToLicenseAssociationMapOutputWithContext(context.Background()) 249 } 250 251 func (i LicenseAssociationMap) ToLicenseAssociationMapOutputWithContext(ctx context.Context) LicenseAssociationMapOutput { 252 return pulumi.ToOutputWithContext(ctx, i).(LicenseAssociationMapOutput) 253 } 254 255 type LicenseAssociationOutput struct{ *pulumi.OutputState } 256 257 func (LicenseAssociationOutput) ElementType() reflect.Type { 258 return reflect.TypeOf((**LicenseAssociation)(nil)).Elem() 259 } 260 261 func (o LicenseAssociationOutput) ToLicenseAssociationOutput() LicenseAssociationOutput { 262 return o 263 } 264 265 func (o LicenseAssociationOutput) ToLicenseAssociationOutputWithContext(ctx context.Context) LicenseAssociationOutput { 266 return o 267 } 268 269 // If `licenseType` is set to `ENTERPRISE_FREE_TRIAL`, this is the expiration date of the free trial. 270 func (o LicenseAssociationOutput) FreeTrialExpiration() pulumi.StringOutput { 271 return o.ApplyT(func(v *LicenseAssociation) pulumi.StringOutput { return v.FreeTrialExpiration }).(pulumi.StringOutput) 272 } 273 274 // If `licenseType` is set to `ENTERPRISE`, this is the expiration date of the enterprise license. 275 func (o LicenseAssociationOutput) LicenseExpiration() pulumi.StringOutput { 276 return o.ApplyT(func(v *LicenseAssociation) pulumi.StringOutput { return v.LicenseExpiration }).(pulumi.StringOutput) 277 } 278 279 // The type of license for the workspace license association. Valid values are `ENTERPRISE` and `ENTERPRISE_FREE_TRIAL`. 280 func (o LicenseAssociationOutput) LicenseType() pulumi.StringOutput { 281 return o.ApplyT(func(v *LicenseAssociation) pulumi.StringOutput { return v.LicenseType }).(pulumi.StringOutput) 282 } 283 284 // The workspace id. 285 func (o LicenseAssociationOutput) WorkspaceId() pulumi.StringOutput { 286 return o.ApplyT(func(v *LicenseAssociation) pulumi.StringOutput { return v.WorkspaceId }).(pulumi.StringOutput) 287 } 288 289 type LicenseAssociationArrayOutput struct{ *pulumi.OutputState } 290 291 func (LicenseAssociationArrayOutput) ElementType() reflect.Type { 292 return reflect.TypeOf((*[]*LicenseAssociation)(nil)).Elem() 293 } 294 295 func (o LicenseAssociationArrayOutput) ToLicenseAssociationArrayOutput() LicenseAssociationArrayOutput { 296 return o 297 } 298 299 func (o LicenseAssociationArrayOutput) ToLicenseAssociationArrayOutputWithContext(ctx context.Context) LicenseAssociationArrayOutput { 300 return o 301 } 302 303 func (o LicenseAssociationArrayOutput) Index(i pulumi.IntInput) LicenseAssociationOutput { 304 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *LicenseAssociation { 305 return vs[0].([]*LicenseAssociation)[vs[1].(int)] 306 }).(LicenseAssociationOutput) 307 } 308 309 type LicenseAssociationMapOutput struct{ *pulumi.OutputState } 310 311 func (LicenseAssociationMapOutput) ElementType() reflect.Type { 312 return reflect.TypeOf((*map[string]*LicenseAssociation)(nil)).Elem() 313 } 314 315 func (o LicenseAssociationMapOutput) ToLicenseAssociationMapOutput() LicenseAssociationMapOutput { 316 return o 317 } 318 319 func (o LicenseAssociationMapOutput) ToLicenseAssociationMapOutputWithContext(ctx context.Context) LicenseAssociationMapOutput { 320 return o 321 } 322 323 func (o LicenseAssociationMapOutput) MapIndex(k pulumi.StringInput) LicenseAssociationOutput { 324 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *LicenseAssociation { 325 return vs[0].(map[string]*LicenseAssociation)[vs[1].(string)] 326 }).(LicenseAssociationOutput) 327 } 328 329 func init() { 330 pulumi.RegisterInputType(reflect.TypeOf((*LicenseAssociationInput)(nil)).Elem(), &LicenseAssociation{}) 331 pulumi.RegisterInputType(reflect.TypeOf((*LicenseAssociationArrayInput)(nil)).Elem(), LicenseAssociationArray{}) 332 pulumi.RegisterInputType(reflect.TypeOf((*LicenseAssociationMapInput)(nil)).Elem(), LicenseAssociationMap{}) 333 pulumi.RegisterOutputType(LicenseAssociationOutput{}) 334 pulumi.RegisterOutputType(LicenseAssociationArrayOutput{}) 335 pulumi.RegisterOutputType(LicenseAssociationMapOutput{}) 336 }