pulumi/tests/testdata/codegen/plain-schema-gh6957/go/xyz/staticPage.go

202 lines
6.1 KiB
Go
Raw Permalink Normal View History

// Code generated by test DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package xyz
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
2023-06-14 19:59:47 +00:00
"plain-schema-gh6957/xyz/internal"
)
type StaticPage struct {
pulumi.ResourceState
// The bucket resource.
Bucket s3.BucketOutput `pulumi:"bucket"`
// The website URL.
WebsiteUrl pulumi.StringOutput `pulumi:"websiteUrl"`
}
// NewStaticPage registers a new resource with the given unique name, arguments, and options.
func NewStaticPage(ctx *pulumi.Context,
name string, args *StaticPageArgs, opts ...pulumi.ResourceOption) (*StaticPage, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.IndexContent == nil {
return nil, errors.New("invalid value for required argument 'IndexContent'")
}
2023-06-14 16:34:49 +00:00
opts = internal.PkgResourceDefaultOpts(opts)
var resource StaticPage
err := ctx.RegisterRemoteComponentResource("xyz:index:StaticPage", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
type staticPageArgs struct {
Foo *Foo `pulumi:"foo"`
// The HTML content for index.html.
IndexContent string `pulumi:"indexContent"`
}
// The set of arguments for constructing a StaticPage resource.
type StaticPageArgs struct {
Foo *FooArgs
// The HTML content for index.html.
IndexContent pulumi.StringInput
}
func (StaticPageArgs) ElementType() reflect.Type {
return reflect.TypeOf((*staticPageArgs)(nil)).Elem()
}
type StaticPageInput interface {
pulumi.Input
ToStaticPageOutput() StaticPageOutput
ToStaticPageOutputWithContext(ctx context.Context) StaticPageOutput
}
func (*StaticPage) ElementType() reflect.Type {
[codegen/go] Remove ResourcePtr input/output types (#8449) These changes remove the `Ptr` variants of input/ouptut types for resources. A `TPtr` input or output is normally generated for `T` if `T` is present in an `optional(input(T))` or `optional(output(T))` and if the Go representation for `T` is not nilable. The generation of `Ptr` variants for resource types breaks the latter rule: the canonical representation of a resource type named `Foo` is a pointer to a struct type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it does not implement the Go `Resource` interface. Because this representation already accommodates `nil` to indicate the lack of a value, we need not generate `FooPtr{Input,Output}` types. Besides being unnecessary, the implementation of `Ptr` types for resources was incorrect. Rather than using `**Foo` as their element type, these types use `*Foo`--identical to the element type used for the normal input/output types. Furthermore, the generated code for at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem` was incorrect, making these types virtually unusable in practice. Finally, these `Ptr` types should never appear on input/output properties in practice, as the logic we use to generate input and output type references never generates them for `optional({input,output}(T)). Instead, it generates references to the standard input/output types. Though this is _technically_ a breaking change--it changes the set of exported types for any package that defines resources--I believe that in practice it will be invisible to users for the reasons stated above. These types are not usable, and were never referenced. This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
return reflect.TypeOf((**StaticPage)(nil)).Elem()
}
func (i *StaticPage) ToStaticPageOutput() StaticPageOutput {
return i.ToStaticPageOutputWithContext(context.Background())
}
func (i *StaticPage) ToStaticPageOutputWithContext(ctx context.Context) StaticPageOutput {
return pulumi.ToOutputWithContext(ctx, i).(StaticPageOutput)
}
// StaticPageArrayInput is an input type that accepts StaticPageArray and StaticPageArrayOutput values.
// You can construct a concrete instance of `StaticPageArrayInput` via:
//
2022-09-14 02:12:02 +00:00
// StaticPageArray{ StaticPageArgs{...} }
type StaticPageArrayInput interface {
pulumi.Input
ToStaticPageArrayOutput() StaticPageArrayOutput
ToStaticPageArrayOutputWithContext(context.Context) StaticPageArrayOutput
}
type StaticPageArray []StaticPageInput
func (StaticPageArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*StaticPage)(nil)).Elem()
}
func (i StaticPageArray) ToStaticPageArrayOutput() StaticPageArrayOutput {
return i.ToStaticPageArrayOutputWithContext(context.Background())
}
func (i StaticPageArray) ToStaticPageArrayOutputWithContext(ctx context.Context) StaticPageArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(StaticPageArrayOutput)
}
// StaticPageMapInput is an input type that accepts StaticPageMap and StaticPageMapOutput values.
// You can construct a concrete instance of `StaticPageMapInput` via:
//
2022-09-14 02:12:02 +00:00
// StaticPageMap{ "key": StaticPageArgs{...} }
type StaticPageMapInput interface {
pulumi.Input
ToStaticPageMapOutput() StaticPageMapOutput
ToStaticPageMapOutputWithContext(context.Context) StaticPageMapOutput
}
type StaticPageMap map[string]StaticPageInput
func (StaticPageMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*StaticPage)(nil)).Elem()
}
func (i StaticPageMap) ToStaticPageMapOutput() StaticPageMapOutput {
return i.ToStaticPageMapOutputWithContext(context.Background())
}
func (i StaticPageMap) ToStaticPageMapOutputWithContext(ctx context.Context) StaticPageMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(StaticPageMapOutput)
}
type StaticPageOutput struct{ *pulumi.OutputState }
func (StaticPageOutput) ElementType() reflect.Type {
[codegen/go] Remove ResourcePtr input/output types (#8449) These changes remove the `Ptr` variants of input/ouptut types for resources. A `TPtr` input or output is normally generated for `T` if `T` is present in an `optional(input(T))` or `optional(output(T))` and if the Go representation for `T` is not nilable. The generation of `Ptr` variants for resource types breaks the latter rule: the canonical representation of a resource type named `Foo` is a pointer to a struct type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it does not implement the Go `Resource` interface. Because this representation already accommodates `nil` to indicate the lack of a value, we need not generate `FooPtr{Input,Output}` types. Besides being unnecessary, the implementation of `Ptr` types for resources was incorrect. Rather than using `**Foo` as their element type, these types use `*Foo`--identical to the element type used for the normal input/output types. Furthermore, the generated code for at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem` was incorrect, making these types virtually unusable in practice. Finally, these `Ptr` types should never appear on input/output properties in practice, as the logic we use to generate input and output type references never generates them for `optional({input,output}(T)). Instead, it generates references to the standard input/output types. Though this is _technically_ a breaking change--it changes the set of exported types for any package that defines resources--I believe that in practice it will be invisible to users for the reasons stated above. These types are not usable, and were never referenced. This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
return reflect.TypeOf((**StaticPage)(nil)).Elem()
}
func (o StaticPageOutput) ToStaticPageOutput() StaticPageOutput {
return o
}
func (o StaticPageOutput) ToStaticPageOutputWithContext(ctx context.Context) StaticPageOutput {
return o
}
// The bucket resource.
func (o StaticPageOutput) Bucket() s3.BucketOutput {
return o.ApplyT(func(v *StaticPage) s3.BucketOutput { return v.Bucket }).(s3.BucketOutput)
}
// The website URL.
func (o StaticPageOutput) WebsiteUrl() pulumi.StringOutput {
return o.ApplyT(func(v *StaticPage) pulumi.StringOutput { return v.WebsiteUrl }).(pulumi.StringOutput)
}
type StaticPageArrayOutput struct{ *pulumi.OutputState }
func (StaticPageArrayOutput) ElementType() reflect.Type {
[codegen/go] Remove ResourcePtr input/output types (#8449) These changes remove the `Ptr` variants of input/ouptut types for resources. A `TPtr` input or output is normally generated for `T` if `T` is present in an `optional(input(T))` or `optional(output(T))` and if the Go representation for `T` is not nilable. The generation of `Ptr` variants for resource types breaks the latter rule: the canonical representation of a resource type named `Foo` is a pointer to a struct type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it does not implement the Go `Resource` interface. Because this representation already accommodates `nil` to indicate the lack of a value, we need not generate `FooPtr{Input,Output}` types. Besides being unnecessary, the implementation of `Ptr` types for resources was incorrect. Rather than using `**Foo` as their element type, these types use `*Foo`--identical to the element type used for the normal input/output types. Furthermore, the generated code for at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem` was incorrect, making these types virtually unusable in practice. Finally, these `Ptr` types should never appear on input/output properties in practice, as the logic we use to generate input and output type references never generates them for `optional({input,output}(T)). Instead, it generates references to the standard input/output types. Though this is _technically_ a breaking change--it changes the set of exported types for any package that defines resources--I believe that in practice it will be invisible to users for the reasons stated above. These types are not usable, and were never referenced. This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
return reflect.TypeOf((*[]*StaticPage)(nil)).Elem()
}
func (o StaticPageArrayOutput) ToStaticPageArrayOutput() StaticPageArrayOutput {
return o
}
func (o StaticPageArrayOutput) ToStaticPageArrayOutputWithContext(ctx context.Context) StaticPageArrayOutput {
return o
}
func (o StaticPageArrayOutput) Index(i pulumi.IntInput) StaticPageOutput {
[codegen/go] Remove ResourcePtr input/output types (#8449) These changes remove the `Ptr` variants of input/ouptut types for resources. A `TPtr` input or output is normally generated for `T` if `T` is present in an `optional(input(T))` or `optional(output(T))` and if the Go representation for `T` is not nilable. The generation of `Ptr` variants for resource types breaks the latter rule: the canonical representation of a resource type named `Foo` is a pointer to a struct type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it does not implement the Go `Resource` interface. Because this representation already accommodates `nil` to indicate the lack of a value, we need not generate `FooPtr{Input,Output}` types. Besides being unnecessary, the implementation of `Ptr` types for resources was incorrect. Rather than using `**Foo` as their element type, these types use `*Foo`--identical to the element type used for the normal input/output types. Furthermore, the generated code for at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem` was incorrect, making these types virtually unusable in practice. Finally, these `Ptr` types should never appear on input/output properties in practice, as the logic we use to generate input and output type references never generates them for `optional({input,output}(T)). Instead, it generates references to the standard input/output types. Though this is _technically_ a breaking change--it changes the set of exported types for any package that defines resources--I believe that in practice it will be invisible to users for the reasons stated above. These types are not usable, and were never referenced. This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *StaticPage {
return vs[0].([]*StaticPage)[vs[1].(int)]
}).(StaticPageOutput)
}
type StaticPageMapOutput struct{ *pulumi.OutputState }
func (StaticPageMapOutput) ElementType() reflect.Type {
[codegen/go] Remove ResourcePtr input/output types (#8449) These changes remove the `Ptr` variants of input/ouptut types for resources. A `TPtr` input or output is normally generated for `T` if `T` is present in an `optional(input(T))` or `optional(output(T))` and if the Go representation for `T` is not nilable. The generation of `Ptr` variants for resource types breaks the latter rule: the canonical representation of a resource type named `Foo` is a pointer to a struct type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it does not implement the Go `Resource` interface. Because this representation already accommodates `nil` to indicate the lack of a value, we need not generate `FooPtr{Input,Output}` types. Besides being unnecessary, the implementation of `Ptr` types for resources was incorrect. Rather than using `**Foo` as their element type, these types use `*Foo`--identical to the element type used for the normal input/output types. Furthermore, the generated code for at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem` was incorrect, making these types virtually unusable in practice. Finally, these `Ptr` types should never appear on input/output properties in practice, as the logic we use to generate input and output type references never generates them for `optional({input,output}(T)). Instead, it generates references to the standard input/output types. Though this is _technically_ a breaking change--it changes the set of exported types for any package that defines resources--I believe that in practice it will be invisible to users for the reasons stated above. These types are not usable, and were never referenced. This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
return reflect.TypeOf((*map[string]*StaticPage)(nil)).Elem()
}
func (o StaticPageMapOutput) ToStaticPageMapOutput() StaticPageMapOutput {
return o
}
func (o StaticPageMapOutput) ToStaticPageMapOutputWithContext(ctx context.Context) StaticPageMapOutput {
return o
}
func (o StaticPageMapOutput) MapIndex(k pulumi.StringInput) StaticPageOutput {
[codegen/go] Remove ResourcePtr input/output types (#8449) These changes remove the `Ptr` variants of input/ouptut types for resources. A `TPtr` input or output is normally generated for `T` if `T` is present in an `optional(input(T))` or `optional(output(T))` and if the Go representation for `T` is not nilable. The generation of `Ptr` variants for resource types breaks the latter rule: the canonical representation of a resource type named `Foo` is a pointer to a struct type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it does not implement the Go `Resource` interface. Because this representation already accommodates `nil` to indicate the lack of a value, we need not generate `FooPtr{Input,Output}` types. Besides being unnecessary, the implementation of `Ptr` types for resources was incorrect. Rather than using `**Foo` as their element type, these types use `*Foo`--identical to the element type used for the normal input/output types. Furthermore, the generated code for at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem` was incorrect, making these types virtually unusable in practice. Finally, these `Ptr` types should never appear on input/output properties in practice, as the logic we use to generate input and output type references never generates them for `optional({input,output}(T)). Instead, it generates references to the standard input/output types. Though this is _technically_ a breaking change--it changes the set of exported types for any package that defines resources--I believe that in practice it will be invisible to users for the reasons stated above. These types are not usable, and were never referenced. This is preparatory work for #7943.
2021-11-23 18:24:56 +00:00
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *StaticPage {
return vs[0].(map[string]*StaticPage)[vs[1].(string)]
}).(StaticPageOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*StaticPageInput)(nil)).Elem(), &StaticPage{})
pulumi.RegisterInputType(reflect.TypeOf((*StaticPageArrayInput)(nil)).Elem(), StaticPageArray{})
pulumi.RegisterInputType(reflect.TypeOf((*StaticPageMapInput)(nil)).Elem(), StaticPageMap{})
pulumi.RegisterOutputType(StaticPageOutput{})
pulumi.RegisterOutputType(StaticPageArrayOutput{})
pulumi.RegisterOutputType(StaticPageMapOutput{})
}