github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudfront/keyGroup.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 cloudfront
     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  // ## Example Usage
    16  //
    17  // The following example below creates a CloudFront key group.
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudfront"
    26  //	"github.com/pulumi/pulumi-std/sdk/go/std"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			invokeFile, err := std.File(ctx, &std.FileArgs{
    34  //				Input: "public_key.pem",
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			example, err := cloudfront.NewPublicKey(ctx, "example", &cloudfront.PublicKeyArgs{
    40  //				Comment:    pulumi.String("example public key"),
    41  //				EncodedKey: invokeFile.Result,
    42  //				Name:       pulumi.String("example-key"),
    43  //			})
    44  //			if err != nil {
    45  //				return err
    46  //			}
    47  //			_, err = cloudfront.NewKeyGroup(ctx, "example", &cloudfront.KeyGroupArgs{
    48  //				Comment: pulumi.String("example key group"),
    49  //				Items: pulumi.StringArray{
    50  //					example.ID(),
    51  //				},
    52  //				Name: pulumi.String("example-key-group"),
    53  //			})
    54  //			if err != nil {
    55  //				return err
    56  //			}
    57  //			return nil
    58  //		})
    59  //	}
    60  //
    61  // ```
    62  // <!--End PulumiCodeChooser -->
    63  //
    64  // ## Import
    65  //
    66  // Using `pulumi import`, import CloudFront Key Group using the `id`. For example:
    67  //
    68  // ```sh
    69  // $ pulumi import aws:cloudfront/keyGroup:KeyGroup example 4b4f2r1c-315d-5c2e-f093-216t50jed10f
    70  // ```
    71  type KeyGroup struct {
    72  	pulumi.CustomResourceState
    73  
    74  	// A comment to describe the key group..
    75  	Comment pulumi.StringPtrOutput `pulumi:"comment"`
    76  	// The identifier for this version of the key group.
    77  	Etag pulumi.StringOutput `pulumi:"etag"`
    78  	// A list of the identifiers of the public keys in the key group.
    79  	Items pulumi.StringArrayOutput `pulumi:"items"`
    80  	// A name to identify the key group.
    81  	Name pulumi.StringOutput `pulumi:"name"`
    82  }
    83  
    84  // NewKeyGroup registers a new resource with the given unique name, arguments, and options.
    85  func NewKeyGroup(ctx *pulumi.Context,
    86  	name string, args *KeyGroupArgs, opts ...pulumi.ResourceOption) (*KeyGroup, error) {
    87  	if args == nil {
    88  		return nil, errors.New("missing one or more required arguments")
    89  	}
    90  
    91  	if args.Items == nil {
    92  		return nil, errors.New("invalid value for required argument 'Items'")
    93  	}
    94  	opts = internal.PkgResourceDefaultOpts(opts)
    95  	var resource KeyGroup
    96  	err := ctx.RegisterResource("aws:cloudfront/keyGroup:KeyGroup", name, args, &resource, opts...)
    97  	if err != nil {
    98  		return nil, err
    99  	}
   100  	return &resource, nil
   101  }
   102  
   103  // GetKeyGroup gets an existing KeyGroup resource's state with the given name, ID, and optional
   104  // state properties that are used to uniquely qualify the lookup (nil if not required).
   105  func GetKeyGroup(ctx *pulumi.Context,
   106  	name string, id pulumi.IDInput, state *KeyGroupState, opts ...pulumi.ResourceOption) (*KeyGroup, error) {
   107  	var resource KeyGroup
   108  	err := ctx.ReadResource("aws:cloudfront/keyGroup:KeyGroup", name, id, state, &resource, opts...)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	return &resource, nil
   113  }
   114  
   115  // Input properties used for looking up and filtering KeyGroup resources.
   116  type keyGroupState struct {
   117  	// A comment to describe the key group..
   118  	Comment *string `pulumi:"comment"`
   119  	// The identifier for this version of the key group.
   120  	Etag *string `pulumi:"etag"`
   121  	// A list of the identifiers of the public keys in the key group.
   122  	Items []string `pulumi:"items"`
   123  	// A name to identify the key group.
   124  	Name *string `pulumi:"name"`
   125  }
   126  
   127  type KeyGroupState struct {
   128  	// A comment to describe the key group..
   129  	Comment pulumi.StringPtrInput
   130  	// The identifier for this version of the key group.
   131  	Etag pulumi.StringPtrInput
   132  	// A list of the identifiers of the public keys in the key group.
   133  	Items pulumi.StringArrayInput
   134  	// A name to identify the key group.
   135  	Name pulumi.StringPtrInput
   136  }
   137  
   138  func (KeyGroupState) ElementType() reflect.Type {
   139  	return reflect.TypeOf((*keyGroupState)(nil)).Elem()
   140  }
   141  
   142  type keyGroupArgs struct {
   143  	// A comment to describe the key group..
   144  	Comment *string `pulumi:"comment"`
   145  	// A list of the identifiers of the public keys in the key group.
   146  	Items []string `pulumi:"items"`
   147  	// A name to identify the key group.
   148  	Name *string `pulumi:"name"`
   149  }
   150  
   151  // The set of arguments for constructing a KeyGroup resource.
   152  type KeyGroupArgs struct {
   153  	// A comment to describe the key group..
   154  	Comment pulumi.StringPtrInput
   155  	// A list of the identifiers of the public keys in the key group.
   156  	Items pulumi.StringArrayInput
   157  	// A name to identify the key group.
   158  	Name pulumi.StringPtrInput
   159  }
   160  
   161  func (KeyGroupArgs) ElementType() reflect.Type {
   162  	return reflect.TypeOf((*keyGroupArgs)(nil)).Elem()
   163  }
   164  
   165  type KeyGroupInput interface {
   166  	pulumi.Input
   167  
   168  	ToKeyGroupOutput() KeyGroupOutput
   169  	ToKeyGroupOutputWithContext(ctx context.Context) KeyGroupOutput
   170  }
   171  
   172  func (*KeyGroup) ElementType() reflect.Type {
   173  	return reflect.TypeOf((**KeyGroup)(nil)).Elem()
   174  }
   175  
   176  func (i *KeyGroup) ToKeyGroupOutput() KeyGroupOutput {
   177  	return i.ToKeyGroupOutputWithContext(context.Background())
   178  }
   179  
   180  func (i *KeyGroup) ToKeyGroupOutputWithContext(ctx context.Context) KeyGroupOutput {
   181  	return pulumi.ToOutputWithContext(ctx, i).(KeyGroupOutput)
   182  }
   183  
   184  // KeyGroupArrayInput is an input type that accepts KeyGroupArray and KeyGroupArrayOutput values.
   185  // You can construct a concrete instance of `KeyGroupArrayInput` via:
   186  //
   187  //	KeyGroupArray{ KeyGroupArgs{...} }
   188  type KeyGroupArrayInput interface {
   189  	pulumi.Input
   190  
   191  	ToKeyGroupArrayOutput() KeyGroupArrayOutput
   192  	ToKeyGroupArrayOutputWithContext(context.Context) KeyGroupArrayOutput
   193  }
   194  
   195  type KeyGroupArray []KeyGroupInput
   196  
   197  func (KeyGroupArray) ElementType() reflect.Type {
   198  	return reflect.TypeOf((*[]*KeyGroup)(nil)).Elem()
   199  }
   200  
   201  func (i KeyGroupArray) ToKeyGroupArrayOutput() KeyGroupArrayOutput {
   202  	return i.ToKeyGroupArrayOutputWithContext(context.Background())
   203  }
   204  
   205  func (i KeyGroupArray) ToKeyGroupArrayOutputWithContext(ctx context.Context) KeyGroupArrayOutput {
   206  	return pulumi.ToOutputWithContext(ctx, i).(KeyGroupArrayOutput)
   207  }
   208  
   209  // KeyGroupMapInput is an input type that accepts KeyGroupMap and KeyGroupMapOutput values.
   210  // You can construct a concrete instance of `KeyGroupMapInput` via:
   211  //
   212  //	KeyGroupMap{ "key": KeyGroupArgs{...} }
   213  type KeyGroupMapInput interface {
   214  	pulumi.Input
   215  
   216  	ToKeyGroupMapOutput() KeyGroupMapOutput
   217  	ToKeyGroupMapOutputWithContext(context.Context) KeyGroupMapOutput
   218  }
   219  
   220  type KeyGroupMap map[string]KeyGroupInput
   221  
   222  func (KeyGroupMap) ElementType() reflect.Type {
   223  	return reflect.TypeOf((*map[string]*KeyGroup)(nil)).Elem()
   224  }
   225  
   226  func (i KeyGroupMap) ToKeyGroupMapOutput() KeyGroupMapOutput {
   227  	return i.ToKeyGroupMapOutputWithContext(context.Background())
   228  }
   229  
   230  func (i KeyGroupMap) ToKeyGroupMapOutputWithContext(ctx context.Context) KeyGroupMapOutput {
   231  	return pulumi.ToOutputWithContext(ctx, i).(KeyGroupMapOutput)
   232  }
   233  
   234  type KeyGroupOutput struct{ *pulumi.OutputState }
   235  
   236  func (KeyGroupOutput) ElementType() reflect.Type {
   237  	return reflect.TypeOf((**KeyGroup)(nil)).Elem()
   238  }
   239  
   240  func (o KeyGroupOutput) ToKeyGroupOutput() KeyGroupOutput {
   241  	return o
   242  }
   243  
   244  func (o KeyGroupOutput) ToKeyGroupOutputWithContext(ctx context.Context) KeyGroupOutput {
   245  	return o
   246  }
   247  
   248  // A comment to describe the key group..
   249  func (o KeyGroupOutput) Comment() pulumi.StringPtrOutput {
   250  	return o.ApplyT(func(v *KeyGroup) pulumi.StringPtrOutput { return v.Comment }).(pulumi.StringPtrOutput)
   251  }
   252  
   253  // The identifier for this version of the key group.
   254  func (o KeyGroupOutput) Etag() pulumi.StringOutput {
   255  	return o.ApplyT(func(v *KeyGroup) pulumi.StringOutput { return v.Etag }).(pulumi.StringOutput)
   256  }
   257  
   258  // A list of the identifiers of the public keys in the key group.
   259  func (o KeyGroupOutput) Items() pulumi.StringArrayOutput {
   260  	return o.ApplyT(func(v *KeyGroup) pulumi.StringArrayOutput { return v.Items }).(pulumi.StringArrayOutput)
   261  }
   262  
   263  // A name to identify the key group.
   264  func (o KeyGroupOutput) Name() pulumi.StringOutput {
   265  	return o.ApplyT(func(v *KeyGroup) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   266  }
   267  
   268  type KeyGroupArrayOutput struct{ *pulumi.OutputState }
   269  
   270  func (KeyGroupArrayOutput) ElementType() reflect.Type {
   271  	return reflect.TypeOf((*[]*KeyGroup)(nil)).Elem()
   272  }
   273  
   274  func (o KeyGroupArrayOutput) ToKeyGroupArrayOutput() KeyGroupArrayOutput {
   275  	return o
   276  }
   277  
   278  func (o KeyGroupArrayOutput) ToKeyGroupArrayOutputWithContext(ctx context.Context) KeyGroupArrayOutput {
   279  	return o
   280  }
   281  
   282  func (o KeyGroupArrayOutput) Index(i pulumi.IntInput) KeyGroupOutput {
   283  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *KeyGroup {
   284  		return vs[0].([]*KeyGroup)[vs[1].(int)]
   285  	}).(KeyGroupOutput)
   286  }
   287  
   288  type KeyGroupMapOutput struct{ *pulumi.OutputState }
   289  
   290  func (KeyGroupMapOutput) ElementType() reflect.Type {
   291  	return reflect.TypeOf((*map[string]*KeyGroup)(nil)).Elem()
   292  }
   293  
   294  func (o KeyGroupMapOutput) ToKeyGroupMapOutput() KeyGroupMapOutput {
   295  	return o
   296  }
   297  
   298  func (o KeyGroupMapOutput) ToKeyGroupMapOutputWithContext(ctx context.Context) KeyGroupMapOutput {
   299  	return o
   300  }
   301  
   302  func (o KeyGroupMapOutput) MapIndex(k pulumi.StringInput) KeyGroupOutput {
   303  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *KeyGroup {
   304  		return vs[0].(map[string]*KeyGroup)[vs[1].(string)]
   305  	}).(KeyGroupOutput)
   306  }
   307  
   308  func init() {
   309  	pulumi.RegisterInputType(reflect.TypeOf((*KeyGroupInput)(nil)).Elem(), &KeyGroup{})
   310  	pulumi.RegisterInputType(reflect.TypeOf((*KeyGroupArrayInput)(nil)).Elem(), KeyGroupArray{})
   311  	pulumi.RegisterInputType(reflect.TypeOf((*KeyGroupMapInput)(nil)).Elem(), KeyGroupMap{})
   312  	pulumi.RegisterOutputType(KeyGroupOutput{})
   313  	pulumi.RegisterOutputType(KeyGroupArrayOutput{})
   314  	pulumi.RegisterOutputType(KeyGroupMapOutput{})
   315  }