github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lambda/functionUrl.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 lambda 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 a Lambda function URL resource. A function URL is a dedicated HTTP(S) endpoint for a Lambda function. 16 // 17 // See the [AWS Lambda documentation](https://docs.aws.amazon.com/lambda/latest/dg/lambda-urls.html) for more information. 18 // 19 // ## Example Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // _, err := lambda.NewFunctionUrl(ctx, "test_latest", &lambda.FunctionUrlArgs{ 35 // FunctionName: pulumi.Any(test.FunctionName), 36 // AuthorizationType: pulumi.String("NONE"), 37 // }) 38 // if err != nil { 39 // return err 40 // } 41 // _, err = lambda.NewFunctionUrl(ctx, "test_live", &lambda.FunctionUrlArgs{ 42 // FunctionName: pulumi.Any(test.FunctionName), 43 // Qualifier: pulumi.String("my_alias"), 44 // AuthorizationType: pulumi.String("AWS_IAM"), 45 // Cors: &lambda.FunctionUrlCorsArgs{ 46 // AllowCredentials: pulumi.Bool(true), 47 // AllowOrigins: pulumi.StringArray{ 48 // pulumi.String("*"), 49 // }, 50 // AllowMethods: pulumi.StringArray{ 51 // pulumi.String("*"), 52 // }, 53 // AllowHeaders: pulumi.StringArray{ 54 // pulumi.String("date"), 55 // pulumi.String("keep-alive"), 56 // }, 57 // ExposeHeaders: pulumi.StringArray{ 58 // pulumi.String("keep-alive"), 59 // pulumi.String("date"), 60 // }, 61 // MaxAge: pulumi.Int(86400), 62 // }, 63 // }) 64 // if err != nil { 65 // return err 66 // } 67 // return nil 68 // }) 69 // } 70 // 71 // ``` 72 // <!--End PulumiCodeChooser --> 73 // 74 // ## Import 75 // 76 // Using `pulumi import`, import Lambda function URLs using the `function_name` or `function_name/qualifier`. For example: 77 // 78 // ```sh 79 // $ pulumi import aws:lambda/functionUrl:FunctionUrl test_lambda_url my_test_lambda_function 80 // ``` 81 type FunctionUrl struct { 82 pulumi.CustomResourceState 83 84 // The type of authentication that the function URL uses. Set to `"AWS_IAM"` to restrict access to authenticated IAM users only. Set to `"NONE"` to bypass IAM authentication and create a public endpoint. See the [AWS documentation](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html) for more details. 85 AuthorizationType pulumi.StringOutput `pulumi:"authorizationType"` 86 // The [cross-origin resource sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) settings for the function URL. Documented below. 87 Cors FunctionUrlCorsPtrOutput `pulumi:"cors"` 88 // The Amazon Resource Name (ARN) of the function. 89 FunctionArn pulumi.StringOutput `pulumi:"functionArn"` 90 // The name (or ARN) of the Lambda function. 91 FunctionName pulumi.StringOutput `pulumi:"functionName"` 92 // The HTTP URL endpoint for the function in the format `https://<url_id>.lambda-url.<region>.on.aws/`. 93 FunctionUrl pulumi.StringOutput `pulumi:"functionUrl"` 94 // Determines how the Lambda function responds to an invocation. Valid values are `BUFFERED` (default) and `RESPONSE_STREAM`. See more in [Configuring a Lambda function to stream responses](https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html). 95 InvokeMode pulumi.StringPtrOutput `pulumi:"invokeMode"` 96 // The alias name or `"$LATEST"`. 97 Qualifier pulumi.StringPtrOutput `pulumi:"qualifier"` 98 // A generated ID for the endpoint. 99 UrlId pulumi.StringOutput `pulumi:"urlId"` 100 } 101 102 // NewFunctionUrl registers a new resource with the given unique name, arguments, and options. 103 func NewFunctionUrl(ctx *pulumi.Context, 104 name string, args *FunctionUrlArgs, opts ...pulumi.ResourceOption) (*FunctionUrl, error) { 105 if args == nil { 106 return nil, errors.New("missing one or more required arguments") 107 } 108 109 if args.AuthorizationType == nil { 110 return nil, errors.New("invalid value for required argument 'AuthorizationType'") 111 } 112 if args.FunctionName == nil { 113 return nil, errors.New("invalid value for required argument 'FunctionName'") 114 } 115 opts = internal.PkgResourceDefaultOpts(opts) 116 var resource FunctionUrl 117 err := ctx.RegisterResource("aws:lambda/functionUrl:FunctionUrl", name, args, &resource, opts...) 118 if err != nil { 119 return nil, err 120 } 121 return &resource, nil 122 } 123 124 // GetFunctionUrl gets an existing FunctionUrl resource's state with the given name, ID, and optional 125 // state properties that are used to uniquely qualify the lookup (nil if not required). 126 func GetFunctionUrl(ctx *pulumi.Context, 127 name string, id pulumi.IDInput, state *FunctionUrlState, opts ...pulumi.ResourceOption) (*FunctionUrl, error) { 128 var resource FunctionUrl 129 err := ctx.ReadResource("aws:lambda/functionUrl:FunctionUrl", name, id, state, &resource, opts...) 130 if err != nil { 131 return nil, err 132 } 133 return &resource, nil 134 } 135 136 // Input properties used for looking up and filtering FunctionUrl resources. 137 type functionUrlState struct { 138 // The type of authentication that the function URL uses. Set to `"AWS_IAM"` to restrict access to authenticated IAM users only. Set to `"NONE"` to bypass IAM authentication and create a public endpoint. See the [AWS documentation](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html) for more details. 139 AuthorizationType *string `pulumi:"authorizationType"` 140 // The [cross-origin resource sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) settings for the function URL. Documented below. 141 Cors *FunctionUrlCors `pulumi:"cors"` 142 // The Amazon Resource Name (ARN) of the function. 143 FunctionArn *string `pulumi:"functionArn"` 144 // The name (or ARN) of the Lambda function. 145 FunctionName *string `pulumi:"functionName"` 146 // The HTTP URL endpoint for the function in the format `https://<url_id>.lambda-url.<region>.on.aws/`. 147 FunctionUrl *string `pulumi:"functionUrl"` 148 // Determines how the Lambda function responds to an invocation. Valid values are `BUFFERED` (default) and `RESPONSE_STREAM`. See more in [Configuring a Lambda function to stream responses](https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html). 149 InvokeMode *string `pulumi:"invokeMode"` 150 // The alias name or `"$LATEST"`. 151 Qualifier *string `pulumi:"qualifier"` 152 // A generated ID for the endpoint. 153 UrlId *string `pulumi:"urlId"` 154 } 155 156 type FunctionUrlState struct { 157 // The type of authentication that the function URL uses. Set to `"AWS_IAM"` to restrict access to authenticated IAM users only. Set to `"NONE"` to bypass IAM authentication and create a public endpoint. See the [AWS documentation](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html) for more details. 158 AuthorizationType pulumi.StringPtrInput 159 // The [cross-origin resource sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) settings for the function URL. Documented below. 160 Cors FunctionUrlCorsPtrInput 161 // The Amazon Resource Name (ARN) of the function. 162 FunctionArn pulumi.StringPtrInput 163 // The name (or ARN) of the Lambda function. 164 FunctionName pulumi.StringPtrInput 165 // The HTTP URL endpoint for the function in the format `https://<url_id>.lambda-url.<region>.on.aws/`. 166 FunctionUrl pulumi.StringPtrInput 167 // Determines how the Lambda function responds to an invocation. Valid values are `BUFFERED` (default) and `RESPONSE_STREAM`. See more in [Configuring a Lambda function to stream responses](https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html). 168 InvokeMode pulumi.StringPtrInput 169 // The alias name or `"$LATEST"`. 170 Qualifier pulumi.StringPtrInput 171 // A generated ID for the endpoint. 172 UrlId pulumi.StringPtrInput 173 } 174 175 func (FunctionUrlState) ElementType() reflect.Type { 176 return reflect.TypeOf((*functionUrlState)(nil)).Elem() 177 } 178 179 type functionUrlArgs struct { 180 // The type of authentication that the function URL uses. Set to `"AWS_IAM"` to restrict access to authenticated IAM users only. Set to `"NONE"` to bypass IAM authentication and create a public endpoint. See the [AWS documentation](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html) for more details. 181 AuthorizationType string `pulumi:"authorizationType"` 182 // The [cross-origin resource sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) settings for the function URL. Documented below. 183 Cors *FunctionUrlCors `pulumi:"cors"` 184 // The name (or ARN) of the Lambda function. 185 FunctionName string `pulumi:"functionName"` 186 // Determines how the Lambda function responds to an invocation. Valid values are `BUFFERED` (default) and `RESPONSE_STREAM`. See more in [Configuring a Lambda function to stream responses](https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html). 187 InvokeMode *string `pulumi:"invokeMode"` 188 // The alias name or `"$LATEST"`. 189 Qualifier *string `pulumi:"qualifier"` 190 } 191 192 // The set of arguments for constructing a FunctionUrl resource. 193 type FunctionUrlArgs struct { 194 // The type of authentication that the function URL uses. Set to `"AWS_IAM"` to restrict access to authenticated IAM users only. Set to `"NONE"` to bypass IAM authentication and create a public endpoint. See the [AWS documentation](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html) for more details. 195 AuthorizationType pulumi.StringInput 196 // The [cross-origin resource sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) settings for the function URL. Documented below. 197 Cors FunctionUrlCorsPtrInput 198 // The name (or ARN) of the Lambda function. 199 FunctionName pulumi.StringInput 200 // Determines how the Lambda function responds to an invocation. Valid values are `BUFFERED` (default) and `RESPONSE_STREAM`. See more in [Configuring a Lambda function to stream responses](https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html). 201 InvokeMode pulumi.StringPtrInput 202 // The alias name or `"$LATEST"`. 203 Qualifier pulumi.StringPtrInput 204 } 205 206 func (FunctionUrlArgs) ElementType() reflect.Type { 207 return reflect.TypeOf((*functionUrlArgs)(nil)).Elem() 208 } 209 210 type FunctionUrlInput interface { 211 pulumi.Input 212 213 ToFunctionUrlOutput() FunctionUrlOutput 214 ToFunctionUrlOutputWithContext(ctx context.Context) FunctionUrlOutput 215 } 216 217 func (*FunctionUrl) ElementType() reflect.Type { 218 return reflect.TypeOf((**FunctionUrl)(nil)).Elem() 219 } 220 221 func (i *FunctionUrl) ToFunctionUrlOutput() FunctionUrlOutput { 222 return i.ToFunctionUrlOutputWithContext(context.Background()) 223 } 224 225 func (i *FunctionUrl) ToFunctionUrlOutputWithContext(ctx context.Context) FunctionUrlOutput { 226 return pulumi.ToOutputWithContext(ctx, i).(FunctionUrlOutput) 227 } 228 229 // FunctionUrlArrayInput is an input type that accepts FunctionUrlArray and FunctionUrlArrayOutput values. 230 // You can construct a concrete instance of `FunctionUrlArrayInput` via: 231 // 232 // FunctionUrlArray{ FunctionUrlArgs{...} } 233 type FunctionUrlArrayInput interface { 234 pulumi.Input 235 236 ToFunctionUrlArrayOutput() FunctionUrlArrayOutput 237 ToFunctionUrlArrayOutputWithContext(context.Context) FunctionUrlArrayOutput 238 } 239 240 type FunctionUrlArray []FunctionUrlInput 241 242 func (FunctionUrlArray) ElementType() reflect.Type { 243 return reflect.TypeOf((*[]*FunctionUrl)(nil)).Elem() 244 } 245 246 func (i FunctionUrlArray) ToFunctionUrlArrayOutput() FunctionUrlArrayOutput { 247 return i.ToFunctionUrlArrayOutputWithContext(context.Background()) 248 } 249 250 func (i FunctionUrlArray) ToFunctionUrlArrayOutputWithContext(ctx context.Context) FunctionUrlArrayOutput { 251 return pulumi.ToOutputWithContext(ctx, i).(FunctionUrlArrayOutput) 252 } 253 254 // FunctionUrlMapInput is an input type that accepts FunctionUrlMap and FunctionUrlMapOutput values. 255 // You can construct a concrete instance of `FunctionUrlMapInput` via: 256 // 257 // FunctionUrlMap{ "key": FunctionUrlArgs{...} } 258 type FunctionUrlMapInput interface { 259 pulumi.Input 260 261 ToFunctionUrlMapOutput() FunctionUrlMapOutput 262 ToFunctionUrlMapOutputWithContext(context.Context) FunctionUrlMapOutput 263 } 264 265 type FunctionUrlMap map[string]FunctionUrlInput 266 267 func (FunctionUrlMap) ElementType() reflect.Type { 268 return reflect.TypeOf((*map[string]*FunctionUrl)(nil)).Elem() 269 } 270 271 func (i FunctionUrlMap) ToFunctionUrlMapOutput() FunctionUrlMapOutput { 272 return i.ToFunctionUrlMapOutputWithContext(context.Background()) 273 } 274 275 func (i FunctionUrlMap) ToFunctionUrlMapOutputWithContext(ctx context.Context) FunctionUrlMapOutput { 276 return pulumi.ToOutputWithContext(ctx, i).(FunctionUrlMapOutput) 277 } 278 279 type FunctionUrlOutput struct{ *pulumi.OutputState } 280 281 func (FunctionUrlOutput) ElementType() reflect.Type { 282 return reflect.TypeOf((**FunctionUrl)(nil)).Elem() 283 } 284 285 func (o FunctionUrlOutput) ToFunctionUrlOutput() FunctionUrlOutput { 286 return o 287 } 288 289 func (o FunctionUrlOutput) ToFunctionUrlOutputWithContext(ctx context.Context) FunctionUrlOutput { 290 return o 291 } 292 293 // The type of authentication that the function URL uses. Set to `"AWS_IAM"` to restrict access to authenticated IAM users only. Set to `"NONE"` to bypass IAM authentication and create a public endpoint. See the [AWS documentation](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html) for more details. 294 func (o FunctionUrlOutput) AuthorizationType() pulumi.StringOutput { 295 return o.ApplyT(func(v *FunctionUrl) pulumi.StringOutput { return v.AuthorizationType }).(pulumi.StringOutput) 296 } 297 298 // The [cross-origin resource sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) settings for the function URL. Documented below. 299 func (o FunctionUrlOutput) Cors() FunctionUrlCorsPtrOutput { 300 return o.ApplyT(func(v *FunctionUrl) FunctionUrlCorsPtrOutput { return v.Cors }).(FunctionUrlCorsPtrOutput) 301 } 302 303 // The Amazon Resource Name (ARN) of the function. 304 func (o FunctionUrlOutput) FunctionArn() pulumi.StringOutput { 305 return o.ApplyT(func(v *FunctionUrl) pulumi.StringOutput { return v.FunctionArn }).(pulumi.StringOutput) 306 } 307 308 // The name (or ARN) of the Lambda function. 309 func (o FunctionUrlOutput) FunctionName() pulumi.StringOutput { 310 return o.ApplyT(func(v *FunctionUrl) pulumi.StringOutput { return v.FunctionName }).(pulumi.StringOutput) 311 } 312 313 // The HTTP URL endpoint for the function in the format `https://<url_id>.lambda-url.<region>.on.aws/`. 314 func (o FunctionUrlOutput) FunctionUrl() pulumi.StringOutput { 315 return o.ApplyT(func(v *FunctionUrl) pulumi.StringOutput { return v.FunctionUrl }).(pulumi.StringOutput) 316 } 317 318 // Determines how the Lambda function responds to an invocation. Valid values are `BUFFERED` (default) and `RESPONSE_STREAM`. See more in [Configuring a Lambda function to stream responses](https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html). 319 func (o FunctionUrlOutput) InvokeMode() pulumi.StringPtrOutput { 320 return o.ApplyT(func(v *FunctionUrl) pulumi.StringPtrOutput { return v.InvokeMode }).(pulumi.StringPtrOutput) 321 } 322 323 // The alias name or `"$LATEST"`. 324 func (o FunctionUrlOutput) Qualifier() pulumi.StringPtrOutput { 325 return o.ApplyT(func(v *FunctionUrl) pulumi.StringPtrOutput { return v.Qualifier }).(pulumi.StringPtrOutput) 326 } 327 328 // A generated ID for the endpoint. 329 func (o FunctionUrlOutput) UrlId() pulumi.StringOutput { 330 return o.ApplyT(func(v *FunctionUrl) pulumi.StringOutput { return v.UrlId }).(pulumi.StringOutput) 331 } 332 333 type FunctionUrlArrayOutput struct{ *pulumi.OutputState } 334 335 func (FunctionUrlArrayOutput) ElementType() reflect.Type { 336 return reflect.TypeOf((*[]*FunctionUrl)(nil)).Elem() 337 } 338 339 func (o FunctionUrlArrayOutput) ToFunctionUrlArrayOutput() FunctionUrlArrayOutput { 340 return o 341 } 342 343 func (o FunctionUrlArrayOutput) ToFunctionUrlArrayOutputWithContext(ctx context.Context) FunctionUrlArrayOutput { 344 return o 345 } 346 347 func (o FunctionUrlArrayOutput) Index(i pulumi.IntInput) FunctionUrlOutput { 348 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *FunctionUrl { 349 return vs[0].([]*FunctionUrl)[vs[1].(int)] 350 }).(FunctionUrlOutput) 351 } 352 353 type FunctionUrlMapOutput struct{ *pulumi.OutputState } 354 355 func (FunctionUrlMapOutput) ElementType() reflect.Type { 356 return reflect.TypeOf((*map[string]*FunctionUrl)(nil)).Elem() 357 } 358 359 func (o FunctionUrlMapOutput) ToFunctionUrlMapOutput() FunctionUrlMapOutput { 360 return o 361 } 362 363 func (o FunctionUrlMapOutput) ToFunctionUrlMapOutputWithContext(ctx context.Context) FunctionUrlMapOutput { 364 return o 365 } 366 367 func (o FunctionUrlMapOutput) MapIndex(k pulumi.StringInput) FunctionUrlOutput { 368 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *FunctionUrl { 369 return vs[0].(map[string]*FunctionUrl)[vs[1].(string)] 370 }).(FunctionUrlOutput) 371 } 372 373 func init() { 374 pulumi.RegisterInputType(reflect.TypeOf((*FunctionUrlInput)(nil)).Elem(), &FunctionUrl{}) 375 pulumi.RegisterInputType(reflect.TypeOf((*FunctionUrlArrayInput)(nil)).Elem(), FunctionUrlArray{}) 376 pulumi.RegisterInputType(reflect.TypeOf((*FunctionUrlMapInput)(nil)).Elem(), FunctionUrlMap{}) 377 pulumi.RegisterOutputType(FunctionUrlOutput{}) 378 pulumi.RegisterOutputType(FunctionUrlArrayOutput{}) 379 pulumi.RegisterOutputType(FunctionUrlMapOutput{}) 380 }