github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ssm/patchGroup.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 ssm
     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 SSM Patch Group resource
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			production, err := ssm.NewPatchBaseline(ctx, "production", &ssm.PatchBaselineArgs{
    33  //				Name: pulumi.String("patch-baseline"),
    34  //				ApprovedPatches: pulumi.StringArray{
    35  //					pulumi.String("KB123456"),
    36  //				},
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			_, err = ssm.NewPatchGroup(ctx, "patchgroup", &ssm.PatchGroupArgs{
    42  //				BaselineId: production.ID(),
    43  //				PatchGroup: pulumi.String("patch-group-name"),
    44  //			})
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			return nil
    49  //		})
    50  //	}
    51  //
    52  // ```
    53  // <!--End PulumiCodeChooser -->
    54  type PatchGroup struct {
    55  	pulumi.CustomResourceState
    56  
    57  	// The ID of the patch baseline to register the patch group with.
    58  	BaselineId pulumi.StringOutput `pulumi:"baselineId"`
    59  	// The name of the patch group that should be registered with the patch baseline.
    60  	PatchGroup pulumi.StringOutput `pulumi:"patchGroup"`
    61  }
    62  
    63  // NewPatchGroup registers a new resource with the given unique name, arguments, and options.
    64  func NewPatchGroup(ctx *pulumi.Context,
    65  	name string, args *PatchGroupArgs, opts ...pulumi.ResourceOption) (*PatchGroup, error) {
    66  	if args == nil {
    67  		return nil, errors.New("missing one or more required arguments")
    68  	}
    69  
    70  	if args.BaselineId == nil {
    71  		return nil, errors.New("invalid value for required argument 'BaselineId'")
    72  	}
    73  	if args.PatchGroup == nil {
    74  		return nil, errors.New("invalid value for required argument 'PatchGroup'")
    75  	}
    76  	opts = internal.PkgResourceDefaultOpts(opts)
    77  	var resource PatchGroup
    78  	err := ctx.RegisterResource("aws:ssm/patchGroup:PatchGroup", name, args, &resource, opts...)
    79  	if err != nil {
    80  		return nil, err
    81  	}
    82  	return &resource, nil
    83  }
    84  
    85  // GetPatchGroup gets an existing PatchGroup resource's state with the given name, ID, and optional
    86  // state properties that are used to uniquely qualify the lookup (nil if not required).
    87  func GetPatchGroup(ctx *pulumi.Context,
    88  	name string, id pulumi.IDInput, state *PatchGroupState, opts ...pulumi.ResourceOption) (*PatchGroup, error) {
    89  	var resource PatchGroup
    90  	err := ctx.ReadResource("aws:ssm/patchGroup:PatchGroup", name, id, state, &resource, opts...)
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  	return &resource, nil
    95  }
    96  
    97  // Input properties used for looking up and filtering PatchGroup resources.
    98  type patchGroupState struct {
    99  	// The ID of the patch baseline to register the patch group with.
   100  	BaselineId *string `pulumi:"baselineId"`
   101  	// The name of the patch group that should be registered with the patch baseline.
   102  	PatchGroup *string `pulumi:"patchGroup"`
   103  }
   104  
   105  type PatchGroupState struct {
   106  	// The ID of the patch baseline to register the patch group with.
   107  	BaselineId pulumi.StringPtrInput
   108  	// The name of the patch group that should be registered with the patch baseline.
   109  	PatchGroup pulumi.StringPtrInput
   110  }
   111  
   112  func (PatchGroupState) ElementType() reflect.Type {
   113  	return reflect.TypeOf((*patchGroupState)(nil)).Elem()
   114  }
   115  
   116  type patchGroupArgs struct {
   117  	// The ID of the patch baseline to register the patch group with.
   118  	BaselineId string `pulumi:"baselineId"`
   119  	// The name of the patch group that should be registered with the patch baseline.
   120  	PatchGroup string `pulumi:"patchGroup"`
   121  }
   122  
   123  // The set of arguments for constructing a PatchGroup resource.
   124  type PatchGroupArgs struct {
   125  	// The ID of the patch baseline to register the patch group with.
   126  	BaselineId pulumi.StringInput
   127  	// The name of the patch group that should be registered with the patch baseline.
   128  	PatchGroup pulumi.StringInput
   129  }
   130  
   131  func (PatchGroupArgs) ElementType() reflect.Type {
   132  	return reflect.TypeOf((*patchGroupArgs)(nil)).Elem()
   133  }
   134  
   135  type PatchGroupInput interface {
   136  	pulumi.Input
   137  
   138  	ToPatchGroupOutput() PatchGroupOutput
   139  	ToPatchGroupOutputWithContext(ctx context.Context) PatchGroupOutput
   140  }
   141  
   142  func (*PatchGroup) ElementType() reflect.Type {
   143  	return reflect.TypeOf((**PatchGroup)(nil)).Elem()
   144  }
   145  
   146  func (i *PatchGroup) ToPatchGroupOutput() PatchGroupOutput {
   147  	return i.ToPatchGroupOutputWithContext(context.Background())
   148  }
   149  
   150  func (i *PatchGroup) ToPatchGroupOutputWithContext(ctx context.Context) PatchGroupOutput {
   151  	return pulumi.ToOutputWithContext(ctx, i).(PatchGroupOutput)
   152  }
   153  
   154  // PatchGroupArrayInput is an input type that accepts PatchGroupArray and PatchGroupArrayOutput values.
   155  // You can construct a concrete instance of `PatchGroupArrayInput` via:
   156  //
   157  //	PatchGroupArray{ PatchGroupArgs{...} }
   158  type PatchGroupArrayInput interface {
   159  	pulumi.Input
   160  
   161  	ToPatchGroupArrayOutput() PatchGroupArrayOutput
   162  	ToPatchGroupArrayOutputWithContext(context.Context) PatchGroupArrayOutput
   163  }
   164  
   165  type PatchGroupArray []PatchGroupInput
   166  
   167  func (PatchGroupArray) ElementType() reflect.Type {
   168  	return reflect.TypeOf((*[]*PatchGroup)(nil)).Elem()
   169  }
   170  
   171  func (i PatchGroupArray) ToPatchGroupArrayOutput() PatchGroupArrayOutput {
   172  	return i.ToPatchGroupArrayOutputWithContext(context.Background())
   173  }
   174  
   175  func (i PatchGroupArray) ToPatchGroupArrayOutputWithContext(ctx context.Context) PatchGroupArrayOutput {
   176  	return pulumi.ToOutputWithContext(ctx, i).(PatchGroupArrayOutput)
   177  }
   178  
   179  // PatchGroupMapInput is an input type that accepts PatchGroupMap and PatchGroupMapOutput values.
   180  // You can construct a concrete instance of `PatchGroupMapInput` via:
   181  //
   182  //	PatchGroupMap{ "key": PatchGroupArgs{...} }
   183  type PatchGroupMapInput interface {
   184  	pulumi.Input
   185  
   186  	ToPatchGroupMapOutput() PatchGroupMapOutput
   187  	ToPatchGroupMapOutputWithContext(context.Context) PatchGroupMapOutput
   188  }
   189  
   190  type PatchGroupMap map[string]PatchGroupInput
   191  
   192  func (PatchGroupMap) ElementType() reflect.Type {
   193  	return reflect.TypeOf((*map[string]*PatchGroup)(nil)).Elem()
   194  }
   195  
   196  func (i PatchGroupMap) ToPatchGroupMapOutput() PatchGroupMapOutput {
   197  	return i.ToPatchGroupMapOutputWithContext(context.Background())
   198  }
   199  
   200  func (i PatchGroupMap) ToPatchGroupMapOutputWithContext(ctx context.Context) PatchGroupMapOutput {
   201  	return pulumi.ToOutputWithContext(ctx, i).(PatchGroupMapOutput)
   202  }
   203  
   204  type PatchGroupOutput struct{ *pulumi.OutputState }
   205  
   206  func (PatchGroupOutput) ElementType() reflect.Type {
   207  	return reflect.TypeOf((**PatchGroup)(nil)).Elem()
   208  }
   209  
   210  func (o PatchGroupOutput) ToPatchGroupOutput() PatchGroupOutput {
   211  	return o
   212  }
   213  
   214  func (o PatchGroupOutput) ToPatchGroupOutputWithContext(ctx context.Context) PatchGroupOutput {
   215  	return o
   216  }
   217  
   218  // The ID of the patch baseline to register the patch group with.
   219  func (o PatchGroupOutput) BaselineId() pulumi.StringOutput {
   220  	return o.ApplyT(func(v *PatchGroup) pulumi.StringOutput { return v.BaselineId }).(pulumi.StringOutput)
   221  }
   222  
   223  // The name of the patch group that should be registered with the patch baseline.
   224  func (o PatchGroupOutput) PatchGroup() pulumi.StringOutput {
   225  	return o.ApplyT(func(v *PatchGroup) pulumi.StringOutput { return v.PatchGroup }).(pulumi.StringOutput)
   226  }
   227  
   228  type PatchGroupArrayOutput struct{ *pulumi.OutputState }
   229  
   230  func (PatchGroupArrayOutput) ElementType() reflect.Type {
   231  	return reflect.TypeOf((*[]*PatchGroup)(nil)).Elem()
   232  }
   233  
   234  func (o PatchGroupArrayOutput) ToPatchGroupArrayOutput() PatchGroupArrayOutput {
   235  	return o
   236  }
   237  
   238  func (o PatchGroupArrayOutput) ToPatchGroupArrayOutputWithContext(ctx context.Context) PatchGroupArrayOutput {
   239  	return o
   240  }
   241  
   242  func (o PatchGroupArrayOutput) Index(i pulumi.IntInput) PatchGroupOutput {
   243  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PatchGroup {
   244  		return vs[0].([]*PatchGroup)[vs[1].(int)]
   245  	}).(PatchGroupOutput)
   246  }
   247  
   248  type PatchGroupMapOutput struct{ *pulumi.OutputState }
   249  
   250  func (PatchGroupMapOutput) ElementType() reflect.Type {
   251  	return reflect.TypeOf((*map[string]*PatchGroup)(nil)).Elem()
   252  }
   253  
   254  func (o PatchGroupMapOutput) ToPatchGroupMapOutput() PatchGroupMapOutput {
   255  	return o
   256  }
   257  
   258  func (o PatchGroupMapOutput) ToPatchGroupMapOutputWithContext(ctx context.Context) PatchGroupMapOutput {
   259  	return o
   260  }
   261  
   262  func (o PatchGroupMapOutput) MapIndex(k pulumi.StringInput) PatchGroupOutput {
   263  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PatchGroup {
   264  		return vs[0].(map[string]*PatchGroup)[vs[1].(string)]
   265  	}).(PatchGroupOutput)
   266  }
   267  
   268  func init() {
   269  	pulumi.RegisterInputType(reflect.TypeOf((*PatchGroupInput)(nil)).Elem(), &PatchGroup{})
   270  	pulumi.RegisterInputType(reflect.TypeOf((*PatchGroupArrayInput)(nil)).Elem(), PatchGroupArray{})
   271  	pulumi.RegisterInputType(reflect.TypeOf((*PatchGroupMapInput)(nil)).Elem(), PatchGroupMap{})
   272  	pulumi.RegisterOutputType(PatchGroupOutput{})
   273  	pulumi.RegisterOutputType(PatchGroupArrayOutput{})
   274  	pulumi.RegisterOutputType(PatchGroupMapOutput{})
   275  }