github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/codecommit/approvalRuleTemplate.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 codecommit
     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 CodeCommit Approval Rule Template Resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"encoding/json"
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codecommit"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    35  //				"Version": "2018-11-08",
    36  //				"DestinationReferences": []string{
    37  //					"refs/heads/master",
    38  //				},
    39  //				"Statements": []map[string]interface{}{
    40  //					map[string]interface{}{
    41  //						"Type":                    "Approvers",
    42  //						"NumberOfApprovalsNeeded": 2,
    43  //						"ApprovalPoolMembers": []string{
    44  //							"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*",
    45  //						},
    46  //					},
    47  //				},
    48  //			})
    49  //			if err != nil {
    50  //				return err
    51  //			}
    52  //			json0 := string(tmpJSON0)
    53  //			_, err = codecommit.NewApprovalRuleTemplate(ctx, "example", &codecommit.ApprovalRuleTemplateArgs{
    54  //				Name:        pulumi.String("MyExampleApprovalRuleTemplate"),
    55  //				Description: pulumi.String("This is an example approval rule template"),
    56  //				Content:     pulumi.String(json0),
    57  //			})
    58  //			if err != nil {
    59  //				return err
    60  //			}
    61  //			return nil
    62  //		})
    63  //	}
    64  //
    65  // ```
    66  // <!--End PulumiCodeChooser -->
    67  //
    68  // ## Import
    69  //
    70  // Using `pulumi import`, import CodeCommit approval rule templates using the `name`. For example:
    71  //
    72  // ```sh
    73  // $ pulumi import aws:codecommit/approvalRuleTemplate:ApprovalRuleTemplate imported ExistingApprovalRuleTemplateName
    74  // ```
    75  type ApprovalRuleTemplate struct {
    76  	pulumi.CustomResourceState
    77  
    78  	// The ID of the approval rule template
    79  	ApprovalRuleTemplateId pulumi.StringOutput `pulumi:"approvalRuleTemplateId"`
    80  	// The content of the approval rule template. Maximum of 3000 characters.
    81  	Content pulumi.StringOutput `pulumi:"content"`
    82  	// The date the approval rule template was created, in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
    83  	CreationDate pulumi.StringOutput `pulumi:"creationDate"`
    84  	// The description of the approval rule template. Maximum of 1000 characters.
    85  	Description pulumi.StringPtrOutput `pulumi:"description"`
    86  	// The date the approval rule template was most recently changed, in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
    87  	LastModifiedDate pulumi.StringOutput `pulumi:"lastModifiedDate"`
    88  	// The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
    89  	LastModifiedUser pulumi.StringOutput `pulumi:"lastModifiedUser"`
    90  	// The name for the approval rule template. Maximum of 100 characters.
    91  	Name pulumi.StringOutput `pulumi:"name"`
    92  	// The SHA-256 hash signature for the content of the approval rule template.
    93  	RuleContentSha256 pulumi.StringOutput `pulumi:"ruleContentSha256"`
    94  }
    95  
    96  // NewApprovalRuleTemplate registers a new resource with the given unique name, arguments, and options.
    97  func NewApprovalRuleTemplate(ctx *pulumi.Context,
    98  	name string, args *ApprovalRuleTemplateArgs, opts ...pulumi.ResourceOption) (*ApprovalRuleTemplate, error) {
    99  	if args == nil {
   100  		return nil, errors.New("missing one or more required arguments")
   101  	}
   102  
   103  	if args.Content == nil {
   104  		return nil, errors.New("invalid value for required argument 'Content'")
   105  	}
   106  	opts = internal.PkgResourceDefaultOpts(opts)
   107  	var resource ApprovalRuleTemplate
   108  	err := ctx.RegisterResource("aws:codecommit/approvalRuleTemplate:ApprovalRuleTemplate", name, args, &resource, opts...)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	return &resource, nil
   113  }
   114  
   115  // GetApprovalRuleTemplate gets an existing ApprovalRuleTemplate resource's state with the given name, ID, and optional
   116  // state properties that are used to uniquely qualify the lookup (nil if not required).
   117  func GetApprovalRuleTemplate(ctx *pulumi.Context,
   118  	name string, id pulumi.IDInput, state *ApprovalRuleTemplateState, opts ...pulumi.ResourceOption) (*ApprovalRuleTemplate, error) {
   119  	var resource ApprovalRuleTemplate
   120  	err := ctx.ReadResource("aws:codecommit/approvalRuleTemplate:ApprovalRuleTemplate", name, id, state, &resource, opts...)
   121  	if err != nil {
   122  		return nil, err
   123  	}
   124  	return &resource, nil
   125  }
   126  
   127  // Input properties used for looking up and filtering ApprovalRuleTemplate resources.
   128  type approvalRuleTemplateState struct {
   129  	// The ID of the approval rule template
   130  	ApprovalRuleTemplateId *string `pulumi:"approvalRuleTemplateId"`
   131  	// The content of the approval rule template. Maximum of 3000 characters.
   132  	Content *string `pulumi:"content"`
   133  	// The date the approval rule template was created, in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
   134  	CreationDate *string `pulumi:"creationDate"`
   135  	// The description of the approval rule template. Maximum of 1000 characters.
   136  	Description *string `pulumi:"description"`
   137  	// The date the approval rule template was most recently changed, in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
   138  	LastModifiedDate *string `pulumi:"lastModifiedDate"`
   139  	// The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
   140  	LastModifiedUser *string `pulumi:"lastModifiedUser"`
   141  	// The name for the approval rule template. Maximum of 100 characters.
   142  	Name *string `pulumi:"name"`
   143  	// The SHA-256 hash signature for the content of the approval rule template.
   144  	RuleContentSha256 *string `pulumi:"ruleContentSha256"`
   145  }
   146  
   147  type ApprovalRuleTemplateState struct {
   148  	// The ID of the approval rule template
   149  	ApprovalRuleTemplateId pulumi.StringPtrInput
   150  	// The content of the approval rule template. Maximum of 3000 characters.
   151  	Content pulumi.StringPtrInput
   152  	// The date the approval rule template was created, in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
   153  	CreationDate pulumi.StringPtrInput
   154  	// The description of the approval rule template. Maximum of 1000 characters.
   155  	Description pulumi.StringPtrInput
   156  	// The date the approval rule template was most recently changed, in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
   157  	LastModifiedDate pulumi.StringPtrInput
   158  	// The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
   159  	LastModifiedUser pulumi.StringPtrInput
   160  	// The name for the approval rule template. Maximum of 100 characters.
   161  	Name pulumi.StringPtrInput
   162  	// The SHA-256 hash signature for the content of the approval rule template.
   163  	RuleContentSha256 pulumi.StringPtrInput
   164  }
   165  
   166  func (ApprovalRuleTemplateState) ElementType() reflect.Type {
   167  	return reflect.TypeOf((*approvalRuleTemplateState)(nil)).Elem()
   168  }
   169  
   170  type approvalRuleTemplateArgs struct {
   171  	// The content of the approval rule template. Maximum of 3000 characters.
   172  	Content string `pulumi:"content"`
   173  	// The description of the approval rule template. Maximum of 1000 characters.
   174  	Description *string `pulumi:"description"`
   175  	// The name for the approval rule template. Maximum of 100 characters.
   176  	Name *string `pulumi:"name"`
   177  }
   178  
   179  // The set of arguments for constructing a ApprovalRuleTemplate resource.
   180  type ApprovalRuleTemplateArgs struct {
   181  	// The content of the approval rule template. Maximum of 3000 characters.
   182  	Content pulumi.StringInput
   183  	// The description of the approval rule template. Maximum of 1000 characters.
   184  	Description pulumi.StringPtrInput
   185  	// The name for the approval rule template. Maximum of 100 characters.
   186  	Name pulumi.StringPtrInput
   187  }
   188  
   189  func (ApprovalRuleTemplateArgs) ElementType() reflect.Type {
   190  	return reflect.TypeOf((*approvalRuleTemplateArgs)(nil)).Elem()
   191  }
   192  
   193  type ApprovalRuleTemplateInput interface {
   194  	pulumi.Input
   195  
   196  	ToApprovalRuleTemplateOutput() ApprovalRuleTemplateOutput
   197  	ToApprovalRuleTemplateOutputWithContext(ctx context.Context) ApprovalRuleTemplateOutput
   198  }
   199  
   200  func (*ApprovalRuleTemplate) ElementType() reflect.Type {
   201  	return reflect.TypeOf((**ApprovalRuleTemplate)(nil)).Elem()
   202  }
   203  
   204  func (i *ApprovalRuleTemplate) ToApprovalRuleTemplateOutput() ApprovalRuleTemplateOutput {
   205  	return i.ToApprovalRuleTemplateOutputWithContext(context.Background())
   206  }
   207  
   208  func (i *ApprovalRuleTemplate) ToApprovalRuleTemplateOutputWithContext(ctx context.Context) ApprovalRuleTemplateOutput {
   209  	return pulumi.ToOutputWithContext(ctx, i).(ApprovalRuleTemplateOutput)
   210  }
   211  
   212  // ApprovalRuleTemplateArrayInput is an input type that accepts ApprovalRuleTemplateArray and ApprovalRuleTemplateArrayOutput values.
   213  // You can construct a concrete instance of `ApprovalRuleTemplateArrayInput` via:
   214  //
   215  //	ApprovalRuleTemplateArray{ ApprovalRuleTemplateArgs{...} }
   216  type ApprovalRuleTemplateArrayInput interface {
   217  	pulumi.Input
   218  
   219  	ToApprovalRuleTemplateArrayOutput() ApprovalRuleTemplateArrayOutput
   220  	ToApprovalRuleTemplateArrayOutputWithContext(context.Context) ApprovalRuleTemplateArrayOutput
   221  }
   222  
   223  type ApprovalRuleTemplateArray []ApprovalRuleTemplateInput
   224  
   225  func (ApprovalRuleTemplateArray) ElementType() reflect.Type {
   226  	return reflect.TypeOf((*[]*ApprovalRuleTemplate)(nil)).Elem()
   227  }
   228  
   229  func (i ApprovalRuleTemplateArray) ToApprovalRuleTemplateArrayOutput() ApprovalRuleTemplateArrayOutput {
   230  	return i.ToApprovalRuleTemplateArrayOutputWithContext(context.Background())
   231  }
   232  
   233  func (i ApprovalRuleTemplateArray) ToApprovalRuleTemplateArrayOutputWithContext(ctx context.Context) ApprovalRuleTemplateArrayOutput {
   234  	return pulumi.ToOutputWithContext(ctx, i).(ApprovalRuleTemplateArrayOutput)
   235  }
   236  
   237  // ApprovalRuleTemplateMapInput is an input type that accepts ApprovalRuleTemplateMap and ApprovalRuleTemplateMapOutput values.
   238  // You can construct a concrete instance of `ApprovalRuleTemplateMapInput` via:
   239  //
   240  //	ApprovalRuleTemplateMap{ "key": ApprovalRuleTemplateArgs{...} }
   241  type ApprovalRuleTemplateMapInput interface {
   242  	pulumi.Input
   243  
   244  	ToApprovalRuleTemplateMapOutput() ApprovalRuleTemplateMapOutput
   245  	ToApprovalRuleTemplateMapOutputWithContext(context.Context) ApprovalRuleTemplateMapOutput
   246  }
   247  
   248  type ApprovalRuleTemplateMap map[string]ApprovalRuleTemplateInput
   249  
   250  func (ApprovalRuleTemplateMap) ElementType() reflect.Type {
   251  	return reflect.TypeOf((*map[string]*ApprovalRuleTemplate)(nil)).Elem()
   252  }
   253  
   254  func (i ApprovalRuleTemplateMap) ToApprovalRuleTemplateMapOutput() ApprovalRuleTemplateMapOutput {
   255  	return i.ToApprovalRuleTemplateMapOutputWithContext(context.Background())
   256  }
   257  
   258  func (i ApprovalRuleTemplateMap) ToApprovalRuleTemplateMapOutputWithContext(ctx context.Context) ApprovalRuleTemplateMapOutput {
   259  	return pulumi.ToOutputWithContext(ctx, i).(ApprovalRuleTemplateMapOutput)
   260  }
   261  
   262  type ApprovalRuleTemplateOutput struct{ *pulumi.OutputState }
   263  
   264  func (ApprovalRuleTemplateOutput) ElementType() reflect.Type {
   265  	return reflect.TypeOf((**ApprovalRuleTemplate)(nil)).Elem()
   266  }
   267  
   268  func (o ApprovalRuleTemplateOutput) ToApprovalRuleTemplateOutput() ApprovalRuleTemplateOutput {
   269  	return o
   270  }
   271  
   272  func (o ApprovalRuleTemplateOutput) ToApprovalRuleTemplateOutputWithContext(ctx context.Context) ApprovalRuleTemplateOutput {
   273  	return o
   274  }
   275  
   276  // The ID of the approval rule template
   277  func (o ApprovalRuleTemplateOutput) ApprovalRuleTemplateId() pulumi.StringOutput {
   278  	return o.ApplyT(func(v *ApprovalRuleTemplate) pulumi.StringOutput { return v.ApprovalRuleTemplateId }).(pulumi.StringOutput)
   279  }
   280  
   281  // The content of the approval rule template. Maximum of 3000 characters.
   282  func (o ApprovalRuleTemplateOutput) Content() pulumi.StringOutput {
   283  	return o.ApplyT(func(v *ApprovalRuleTemplate) pulumi.StringOutput { return v.Content }).(pulumi.StringOutput)
   284  }
   285  
   286  // The date the approval rule template was created, in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
   287  func (o ApprovalRuleTemplateOutput) CreationDate() pulumi.StringOutput {
   288  	return o.ApplyT(func(v *ApprovalRuleTemplate) pulumi.StringOutput { return v.CreationDate }).(pulumi.StringOutput)
   289  }
   290  
   291  // The description of the approval rule template. Maximum of 1000 characters.
   292  func (o ApprovalRuleTemplateOutput) Description() pulumi.StringPtrOutput {
   293  	return o.ApplyT(func(v *ApprovalRuleTemplate) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   294  }
   295  
   296  // The date the approval rule template was most recently changed, in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
   297  func (o ApprovalRuleTemplateOutput) LastModifiedDate() pulumi.StringOutput {
   298  	return o.ApplyT(func(v *ApprovalRuleTemplate) pulumi.StringOutput { return v.LastModifiedDate }).(pulumi.StringOutput)
   299  }
   300  
   301  // The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
   302  func (o ApprovalRuleTemplateOutput) LastModifiedUser() pulumi.StringOutput {
   303  	return o.ApplyT(func(v *ApprovalRuleTemplate) pulumi.StringOutput { return v.LastModifiedUser }).(pulumi.StringOutput)
   304  }
   305  
   306  // The name for the approval rule template. Maximum of 100 characters.
   307  func (o ApprovalRuleTemplateOutput) Name() pulumi.StringOutput {
   308  	return o.ApplyT(func(v *ApprovalRuleTemplate) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   309  }
   310  
   311  // The SHA-256 hash signature for the content of the approval rule template.
   312  func (o ApprovalRuleTemplateOutput) RuleContentSha256() pulumi.StringOutput {
   313  	return o.ApplyT(func(v *ApprovalRuleTemplate) pulumi.StringOutput { return v.RuleContentSha256 }).(pulumi.StringOutput)
   314  }
   315  
   316  type ApprovalRuleTemplateArrayOutput struct{ *pulumi.OutputState }
   317  
   318  func (ApprovalRuleTemplateArrayOutput) ElementType() reflect.Type {
   319  	return reflect.TypeOf((*[]*ApprovalRuleTemplate)(nil)).Elem()
   320  }
   321  
   322  func (o ApprovalRuleTemplateArrayOutput) ToApprovalRuleTemplateArrayOutput() ApprovalRuleTemplateArrayOutput {
   323  	return o
   324  }
   325  
   326  func (o ApprovalRuleTemplateArrayOutput) ToApprovalRuleTemplateArrayOutputWithContext(ctx context.Context) ApprovalRuleTemplateArrayOutput {
   327  	return o
   328  }
   329  
   330  func (o ApprovalRuleTemplateArrayOutput) Index(i pulumi.IntInput) ApprovalRuleTemplateOutput {
   331  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ApprovalRuleTemplate {
   332  		return vs[0].([]*ApprovalRuleTemplate)[vs[1].(int)]
   333  	}).(ApprovalRuleTemplateOutput)
   334  }
   335  
   336  type ApprovalRuleTemplateMapOutput struct{ *pulumi.OutputState }
   337  
   338  func (ApprovalRuleTemplateMapOutput) ElementType() reflect.Type {
   339  	return reflect.TypeOf((*map[string]*ApprovalRuleTemplate)(nil)).Elem()
   340  }
   341  
   342  func (o ApprovalRuleTemplateMapOutput) ToApprovalRuleTemplateMapOutput() ApprovalRuleTemplateMapOutput {
   343  	return o
   344  }
   345  
   346  func (o ApprovalRuleTemplateMapOutput) ToApprovalRuleTemplateMapOutputWithContext(ctx context.Context) ApprovalRuleTemplateMapOutput {
   347  	return o
   348  }
   349  
   350  func (o ApprovalRuleTemplateMapOutput) MapIndex(k pulumi.StringInput) ApprovalRuleTemplateOutput {
   351  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ApprovalRuleTemplate {
   352  		return vs[0].(map[string]*ApprovalRuleTemplate)[vs[1].(string)]
   353  	}).(ApprovalRuleTemplateOutput)
   354  }
   355  
   356  func init() {
   357  	pulumi.RegisterInputType(reflect.TypeOf((*ApprovalRuleTemplateInput)(nil)).Elem(), &ApprovalRuleTemplate{})
   358  	pulumi.RegisterInputType(reflect.TypeOf((*ApprovalRuleTemplateArrayInput)(nil)).Elem(), ApprovalRuleTemplateArray{})
   359  	pulumi.RegisterInputType(reflect.TypeOf((*ApprovalRuleTemplateMapInput)(nil)).Elem(), ApprovalRuleTemplateMap{})
   360  	pulumi.RegisterOutputType(ApprovalRuleTemplateOutput{})
   361  	pulumi.RegisterOutputType(ApprovalRuleTemplateArrayOutput{})
   362  	pulumi.RegisterOutputType(ApprovalRuleTemplateMapOutput{})
   363  }