github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/pinpoint/gcmChannel.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 pinpoint
     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 Pinpoint GCM Channel resource.
    16  //
    17  // > **Note:** Api Key argument will be stored in the raw state as plain-text.
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/pinpoint"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			app, err := pinpoint.NewApp(ctx, "app", nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			_, err = pinpoint.NewGcmChannel(ctx, "gcm", &pinpoint.GcmChannelArgs{
    38  //				ApplicationId: app.ApplicationId,
    39  //				ApiKey:        pulumi.String("api_key"),
    40  //			})
    41  //			if err != nil {
    42  //				return err
    43  //			}
    44  //			return nil
    45  //		})
    46  //	}
    47  //
    48  // ```
    49  // <!--End PulumiCodeChooser -->
    50  //
    51  // ## Import
    52  //
    53  // Using `pulumi import`, import Pinpoint GCM Channel using the `application-id`. For example:
    54  //
    55  // ```sh
    56  // $ pulumi import aws:pinpoint/gcmChannel:GcmChannel gcm application-id
    57  // ```
    58  type GcmChannel struct {
    59  	pulumi.CustomResourceState
    60  
    61  	// Platform credential API key from Google.
    62  	ApiKey pulumi.StringOutput `pulumi:"apiKey"`
    63  	// The application ID.
    64  	ApplicationId pulumi.StringOutput `pulumi:"applicationId"`
    65  	// Whether the channel is enabled or disabled. Defaults to `true`.
    66  	Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
    67  }
    68  
    69  // NewGcmChannel registers a new resource with the given unique name, arguments, and options.
    70  func NewGcmChannel(ctx *pulumi.Context,
    71  	name string, args *GcmChannelArgs, opts ...pulumi.ResourceOption) (*GcmChannel, error) {
    72  	if args == nil {
    73  		return nil, errors.New("missing one or more required arguments")
    74  	}
    75  
    76  	if args.ApiKey == nil {
    77  		return nil, errors.New("invalid value for required argument 'ApiKey'")
    78  	}
    79  	if args.ApplicationId == nil {
    80  		return nil, errors.New("invalid value for required argument 'ApplicationId'")
    81  	}
    82  	if args.ApiKey != nil {
    83  		args.ApiKey = pulumi.ToSecret(args.ApiKey).(pulumi.StringInput)
    84  	}
    85  	secrets := pulumi.AdditionalSecretOutputs([]string{
    86  		"apiKey",
    87  	})
    88  	opts = append(opts, secrets)
    89  	opts = internal.PkgResourceDefaultOpts(opts)
    90  	var resource GcmChannel
    91  	err := ctx.RegisterResource("aws:pinpoint/gcmChannel:GcmChannel", name, args, &resource, opts...)
    92  	if err != nil {
    93  		return nil, err
    94  	}
    95  	return &resource, nil
    96  }
    97  
    98  // GetGcmChannel gets an existing GcmChannel resource's state with the given name, ID, and optional
    99  // state properties that are used to uniquely qualify the lookup (nil if not required).
   100  func GetGcmChannel(ctx *pulumi.Context,
   101  	name string, id pulumi.IDInput, state *GcmChannelState, opts ...pulumi.ResourceOption) (*GcmChannel, error) {
   102  	var resource GcmChannel
   103  	err := ctx.ReadResource("aws:pinpoint/gcmChannel:GcmChannel", name, id, state, &resource, opts...)
   104  	if err != nil {
   105  		return nil, err
   106  	}
   107  	return &resource, nil
   108  }
   109  
   110  // Input properties used for looking up and filtering GcmChannel resources.
   111  type gcmChannelState struct {
   112  	// Platform credential API key from Google.
   113  	ApiKey *string `pulumi:"apiKey"`
   114  	// The application ID.
   115  	ApplicationId *string `pulumi:"applicationId"`
   116  	// Whether the channel is enabled or disabled. Defaults to `true`.
   117  	Enabled *bool `pulumi:"enabled"`
   118  }
   119  
   120  type GcmChannelState struct {
   121  	// Platform credential API key from Google.
   122  	ApiKey pulumi.StringPtrInput
   123  	// The application ID.
   124  	ApplicationId pulumi.StringPtrInput
   125  	// Whether the channel is enabled or disabled. Defaults to `true`.
   126  	Enabled pulumi.BoolPtrInput
   127  }
   128  
   129  func (GcmChannelState) ElementType() reflect.Type {
   130  	return reflect.TypeOf((*gcmChannelState)(nil)).Elem()
   131  }
   132  
   133  type gcmChannelArgs struct {
   134  	// Platform credential API key from Google.
   135  	ApiKey string `pulumi:"apiKey"`
   136  	// The application ID.
   137  	ApplicationId string `pulumi:"applicationId"`
   138  	// Whether the channel is enabled or disabled. Defaults to `true`.
   139  	Enabled *bool `pulumi:"enabled"`
   140  }
   141  
   142  // The set of arguments for constructing a GcmChannel resource.
   143  type GcmChannelArgs struct {
   144  	// Platform credential API key from Google.
   145  	ApiKey pulumi.StringInput
   146  	// The application ID.
   147  	ApplicationId pulumi.StringInput
   148  	// Whether the channel is enabled or disabled. Defaults to `true`.
   149  	Enabled pulumi.BoolPtrInput
   150  }
   151  
   152  func (GcmChannelArgs) ElementType() reflect.Type {
   153  	return reflect.TypeOf((*gcmChannelArgs)(nil)).Elem()
   154  }
   155  
   156  type GcmChannelInput interface {
   157  	pulumi.Input
   158  
   159  	ToGcmChannelOutput() GcmChannelOutput
   160  	ToGcmChannelOutputWithContext(ctx context.Context) GcmChannelOutput
   161  }
   162  
   163  func (*GcmChannel) ElementType() reflect.Type {
   164  	return reflect.TypeOf((**GcmChannel)(nil)).Elem()
   165  }
   166  
   167  func (i *GcmChannel) ToGcmChannelOutput() GcmChannelOutput {
   168  	return i.ToGcmChannelOutputWithContext(context.Background())
   169  }
   170  
   171  func (i *GcmChannel) ToGcmChannelOutputWithContext(ctx context.Context) GcmChannelOutput {
   172  	return pulumi.ToOutputWithContext(ctx, i).(GcmChannelOutput)
   173  }
   174  
   175  // GcmChannelArrayInput is an input type that accepts GcmChannelArray and GcmChannelArrayOutput values.
   176  // You can construct a concrete instance of `GcmChannelArrayInput` via:
   177  //
   178  //	GcmChannelArray{ GcmChannelArgs{...} }
   179  type GcmChannelArrayInput interface {
   180  	pulumi.Input
   181  
   182  	ToGcmChannelArrayOutput() GcmChannelArrayOutput
   183  	ToGcmChannelArrayOutputWithContext(context.Context) GcmChannelArrayOutput
   184  }
   185  
   186  type GcmChannelArray []GcmChannelInput
   187  
   188  func (GcmChannelArray) ElementType() reflect.Type {
   189  	return reflect.TypeOf((*[]*GcmChannel)(nil)).Elem()
   190  }
   191  
   192  func (i GcmChannelArray) ToGcmChannelArrayOutput() GcmChannelArrayOutput {
   193  	return i.ToGcmChannelArrayOutputWithContext(context.Background())
   194  }
   195  
   196  func (i GcmChannelArray) ToGcmChannelArrayOutputWithContext(ctx context.Context) GcmChannelArrayOutput {
   197  	return pulumi.ToOutputWithContext(ctx, i).(GcmChannelArrayOutput)
   198  }
   199  
   200  // GcmChannelMapInput is an input type that accepts GcmChannelMap and GcmChannelMapOutput values.
   201  // You can construct a concrete instance of `GcmChannelMapInput` via:
   202  //
   203  //	GcmChannelMap{ "key": GcmChannelArgs{...} }
   204  type GcmChannelMapInput interface {
   205  	pulumi.Input
   206  
   207  	ToGcmChannelMapOutput() GcmChannelMapOutput
   208  	ToGcmChannelMapOutputWithContext(context.Context) GcmChannelMapOutput
   209  }
   210  
   211  type GcmChannelMap map[string]GcmChannelInput
   212  
   213  func (GcmChannelMap) ElementType() reflect.Type {
   214  	return reflect.TypeOf((*map[string]*GcmChannel)(nil)).Elem()
   215  }
   216  
   217  func (i GcmChannelMap) ToGcmChannelMapOutput() GcmChannelMapOutput {
   218  	return i.ToGcmChannelMapOutputWithContext(context.Background())
   219  }
   220  
   221  func (i GcmChannelMap) ToGcmChannelMapOutputWithContext(ctx context.Context) GcmChannelMapOutput {
   222  	return pulumi.ToOutputWithContext(ctx, i).(GcmChannelMapOutput)
   223  }
   224  
   225  type GcmChannelOutput struct{ *pulumi.OutputState }
   226  
   227  func (GcmChannelOutput) ElementType() reflect.Type {
   228  	return reflect.TypeOf((**GcmChannel)(nil)).Elem()
   229  }
   230  
   231  func (o GcmChannelOutput) ToGcmChannelOutput() GcmChannelOutput {
   232  	return o
   233  }
   234  
   235  func (o GcmChannelOutput) ToGcmChannelOutputWithContext(ctx context.Context) GcmChannelOutput {
   236  	return o
   237  }
   238  
   239  // Platform credential API key from Google.
   240  func (o GcmChannelOutput) ApiKey() pulumi.StringOutput {
   241  	return o.ApplyT(func(v *GcmChannel) pulumi.StringOutput { return v.ApiKey }).(pulumi.StringOutput)
   242  }
   243  
   244  // The application ID.
   245  func (o GcmChannelOutput) ApplicationId() pulumi.StringOutput {
   246  	return o.ApplyT(func(v *GcmChannel) pulumi.StringOutput { return v.ApplicationId }).(pulumi.StringOutput)
   247  }
   248  
   249  // Whether the channel is enabled or disabled. Defaults to `true`.
   250  func (o GcmChannelOutput) Enabled() pulumi.BoolPtrOutput {
   251  	return o.ApplyT(func(v *GcmChannel) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
   252  }
   253  
   254  type GcmChannelArrayOutput struct{ *pulumi.OutputState }
   255  
   256  func (GcmChannelArrayOutput) ElementType() reflect.Type {
   257  	return reflect.TypeOf((*[]*GcmChannel)(nil)).Elem()
   258  }
   259  
   260  func (o GcmChannelArrayOutput) ToGcmChannelArrayOutput() GcmChannelArrayOutput {
   261  	return o
   262  }
   263  
   264  func (o GcmChannelArrayOutput) ToGcmChannelArrayOutputWithContext(ctx context.Context) GcmChannelArrayOutput {
   265  	return o
   266  }
   267  
   268  func (o GcmChannelArrayOutput) Index(i pulumi.IntInput) GcmChannelOutput {
   269  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *GcmChannel {
   270  		return vs[0].([]*GcmChannel)[vs[1].(int)]
   271  	}).(GcmChannelOutput)
   272  }
   273  
   274  type GcmChannelMapOutput struct{ *pulumi.OutputState }
   275  
   276  func (GcmChannelMapOutput) ElementType() reflect.Type {
   277  	return reflect.TypeOf((*map[string]*GcmChannel)(nil)).Elem()
   278  }
   279  
   280  func (o GcmChannelMapOutput) ToGcmChannelMapOutput() GcmChannelMapOutput {
   281  	return o
   282  }
   283  
   284  func (o GcmChannelMapOutput) ToGcmChannelMapOutputWithContext(ctx context.Context) GcmChannelMapOutput {
   285  	return o
   286  }
   287  
   288  func (o GcmChannelMapOutput) MapIndex(k pulumi.StringInput) GcmChannelOutput {
   289  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *GcmChannel {
   290  		return vs[0].(map[string]*GcmChannel)[vs[1].(string)]
   291  	}).(GcmChannelOutput)
   292  }
   293  
   294  func init() {
   295  	pulumi.RegisterInputType(reflect.TypeOf((*GcmChannelInput)(nil)).Elem(), &GcmChannel{})
   296  	pulumi.RegisterInputType(reflect.TypeOf((*GcmChannelArrayInput)(nil)).Elem(), GcmChannelArray{})
   297  	pulumi.RegisterInputType(reflect.TypeOf((*GcmChannelMapInput)(nil)).Elem(), GcmChannelMap{})
   298  	pulumi.RegisterOutputType(GcmChannelOutput{})
   299  	pulumi.RegisterOutputType(GcmChannelArrayOutput{})
   300  	pulumi.RegisterOutputType(GcmChannelMapOutput{})
   301  }