github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/codecommit/repository.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 Repository 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/codecommit"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := codecommit.NewRepository(ctx, "test", &codecommit.RepositoryArgs{
    33  //				RepositoryName: pulumi.String("MyTestRepository"),
    34  //				Description:    pulumi.String("This is the Sample App Repository"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  //
    46  // ### AWS KMS Customer Managed Keys (CMK)
    47  //
    48  // <!--Start PulumiCodeChooser -->
    49  // ```go
    50  // package main
    51  //
    52  // import (
    53  //
    54  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codecommit"
    55  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
    56  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    57  //
    58  // )
    59  //
    60  //	func main() {
    61  //		pulumi.Run(func(ctx *pulumi.Context) error {
    62  //			testKey, err := kms.NewKey(ctx, "test", &kms.KeyArgs{
    63  //				Description:          pulumi.String("test"),
    64  //				DeletionWindowInDays: pulumi.Int(7),
    65  //			})
    66  //			if err != nil {
    67  //				return err
    68  //			}
    69  //			_, err = codecommit.NewRepository(ctx, "test", &codecommit.RepositoryArgs{
    70  //				RepositoryName: pulumi.String("MyTestRepository"),
    71  //				Description:    pulumi.String("This is the Sample App Repository"),
    72  //				KmsKeyId:       testKey.Arn,
    73  //			})
    74  //			if err != nil {
    75  //				return err
    76  //			}
    77  //			return nil
    78  //		})
    79  //	}
    80  //
    81  // ```
    82  // <!--End PulumiCodeChooser -->
    83  //
    84  // ## Import
    85  //
    86  // Using `pulumi import`, import CodeCommit repository using repository name. For example:
    87  //
    88  // ```sh
    89  // $ pulumi import aws:codecommit/repository:Repository imported ExistingRepo
    90  // ```
    91  type Repository struct {
    92  	pulumi.CustomResourceState
    93  
    94  	// The ARN of the repository
    95  	Arn pulumi.StringOutput `pulumi:"arn"`
    96  	// The URL to use for cloning the repository over HTTPS.
    97  	CloneUrlHttp pulumi.StringOutput `pulumi:"cloneUrlHttp"`
    98  	// The URL to use for cloning the repository over SSH.
    99  	CloneUrlSsh pulumi.StringOutput `pulumi:"cloneUrlSsh"`
   100  	// The default branch of the repository. The branch specified here needs to exist.
   101  	DefaultBranch pulumi.StringPtrOutput `pulumi:"defaultBranch"`
   102  	// The description of the repository. This needs to be less than 1000 characters
   103  	Description pulumi.StringPtrOutput `pulumi:"description"`
   104  	// The ARN of the encryption key. If no key is specified, the default `aws/codecommit`` Amazon Web Services managed key is used.
   105  	KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"`
   106  	// The ID of the repository
   107  	RepositoryId pulumi.StringOutput `pulumi:"repositoryId"`
   108  	// The name for the repository. This needs to be less than 100 characters.
   109  	RepositoryName pulumi.StringOutput `pulumi:"repositoryName"`
   110  	// Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   111  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   112  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   113  	//
   114  	// Deprecated: Please use `tags` instead.
   115  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   116  }
   117  
   118  // NewRepository registers a new resource with the given unique name, arguments, and options.
   119  func NewRepository(ctx *pulumi.Context,
   120  	name string, args *RepositoryArgs, opts ...pulumi.ResourceOption) (*Repository, error) {
   121  	if args == nil {
   122  		return nil, errors.New("missing one or more required arguments")
   123  	}
   124  
   125  	if args.RepositoryName == nil {
   126  		return nil, errors.New("invalid value for required argument 'RepositoryName'")
   127  	}
   128  	opts = internal.PkgResourceDefaultOpts(opts)
   129  	var resource Repository
   130  	err := ctx.RegisterResource("aws:codecommit/repository:Repository", name, args, &resource, opts...)
   131  	if err != nil {
   132  		return nil, err
   133  	}
   134  	return &resource, nil
   135  }
   136  
   137  // GetRepository gets an existing Repository resource's state with the given name, ID, and optional
   138  // state properties that are used to uniquely qualify the lookup (nil if not required).
   139  func GetRepository(ctx *pulumi.Context,
   140  	name string, id pulumi.IDInput, state *RepositoryState, opts ...pulumi.ResourceOption) (*Repository, error) {
   141  	var resource Repository
   142  	err := ctx.ReadResource("aws:codecommit/repository:Repository", name, id, state, &resource, opts...)
   143  	if err != nil {
   144  		return nil, err
   145  	}
   146  	return &resource, nil
   147  }
   148  
   149  // Input properties used for looking up and filtering Repository resources.
   150  type repositoryState struct {
   151  	// The ARN of the repository
   152  	Arn *string `pulumi:"arn"`
   153  	// The URL to use for cloning the repository over HTTPS.
   154  	CloneUrlHttp *string `pulumi:"cloneUrlHttp"`
   155  	// The URL to use for cloning the repository over SSH.
   156  	CloneUrlSsh *string `pulumi:"cloneUrlSsh"`
   157  	// The default branch of the repository. The branch specified here needs to exist.
   158  	DefaultBranch *string `pulumi:"defaultBranch"`
   159  	// The description of the repository. This needs to be less than 1000 characters
   160  	Description *string `pulumi:"description"`
   161  	// The ARN of the encryption key. If no key is specified, the default `aws/codecommit`` Amazon Web Services managed key is used.
   162  	KmsKeyId *string `pulumi:"kmsKeyId"`
   163  	// The ID of the repository
   164  	RepositoryId *string `pulumi:"repositoryId"`
   165  	// The name for the repository. This needs to be less than 100 characters.
   166  	RepositoryName *string `pulumi:"repositoryName"`
   167  	// Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   168  	Tags map[string]string `pulumi:"tags"`
   169  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   170  	//
   171  	// Deprecated: Please use `tags` instead.
   172  	TagsAll map[string]string `pulumi:"tagsAll"`
   173  }
   174  
   175  type RepositoryState struct {
   176  	// The ARN of the repository
   177  	Arn pulumi.StringPtrInput
   178  	// The URL to use for cloning the repository over HTTPS.
   179  	CloneUrlHttp pulumi.StringPtrInput
   180  	// The URL to use for cloning the repository over SSH.
   181  	CloneUrlSsh pulumi.StringPtrInput
   182  	// The default branch of the repository. The branch specified here needs to exist.
   183  	DefaultBranch pulumi.StringPtrInput
   184  	// The description of the repository. This needs to be less than 1000 characters
   185  	Description pulumi.StringPtrInput
   186  	// The ARN of the encryption key. If no key is specified, the default `aws/codecommit`` Amazon Web Services managed key is used.
   187  	KmsKeyId pulumi.StringPtrInput
   188  	// The ID of the repository
   189  	RepositoryId pulumi.StringPtrInput
   190  	// The name for the repository. This needs to be less than 100 characters.
   191  	RepositoryName pulumi.StringPtrInput
   192  	// Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   193  	Tags pulumi.StringMapInput
   194  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   195  	//
   196  	// Deprecated: Please use `tags` instead.
   197  	TagsAll pulumi.StringMapInput
   198  }
   199  
   200  func (RepositoryState) ElementType() reflect.Type {
   201  	return reflect.TypeOf((*repositoryState)(nil)).Elem()
   202  }
   203  
   204  type repositoryArgs struct {
   205  	// The default branch of the repository. The branch specified here needs to exist.
   206  	DefaultBranch *string `pulumi:"defaultBranch"`
   207  	// The description of the repository. This needs to be less than 1000 characters
   208  	Description *string `pulumi:"description"`
   209  	// The ARN of the encryption key. If no key is specified, the default `aws/codecommit`` Amazon Web Services managed key is used.
   210  	KmsKeyId *string `pulumi:"kmsKeyId"`
   211  	// The name for the repository. This needs to be less than 100 characters.
   212  	RepositoryName string `pulumi:"repositoryName"`
   213  	// Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   214  	Tags map[string]string `pulumi:"tags"`
   215  }
   216  
   217  // The set of arguments for constructing a Repository resource.
   218  type RepositoryArgs struct {
   219  	// The default branch of the repository. The branch specified here needs to exist.
   220  	DefaultBranch pulumi.StringPtrInput
   221  	// The description of the repository. This needs to be less than 1000 characters
   222  	Description pulumi.StringPtrInput
   223  	// The ARN of the encryption key. If no key is specified, the default `aws/codecommit`` Amazon Web Services managed key is used.
   224  	KmsKeyId pulumi.StringPtrInput
   225  	// The name for the repository. This needs to be less than 100 characters.
   226  	RepositoryName pulumi.StringInput
   227  	// Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   228  	Tags pulumi.StringMapInput
   229  }
   230  
   231  func (RepositoryArgs) ElementType() reflect.Type {
   232  	return reflect.TypeOf((*repositoryArgs)(nil)).Elem()
   233  }
   234  
   235  type RepositoryInput interface {
   236  	pulumi.Input
   237  
   238  	ToRepositoryOutput() RepositoryOutput
   239  	ToRepositoryOutputWithContext(ctx context.Context) RepositoryOutput
   240  }
   241  
   242  func (*Repository) ElementType() reflect.Type {
   243  	return reflect.TypeOf((**Repository)(nil)).Elem()
   244  }
   245  
   246  func (i *Repository) ToRepositoryOutput() RepositoryOutput {
   247  	return i.ToRepositoryOutputWithContext(context.Background())
   248  }
   249  
   250  func (i *Repository) ToRepositoryOutputWithContext(ctx context.Context) RepositoryOutput {
   251  	return pulumi.ToOutputWithContext(ctx, i).(RepositoryOutput)
   252  }
   253  
   254  // RepositoryArrayInput is an input type that accepts RepositoryArray and RepositoryArrayOutput values.
   255  // You can construct a concrete instance of `RepositoryArrayInput` via:
   256  //
   257  //	RepositoryArray{ RepositoryArgs{...} }
   258  type RepositoryArrayInput interface {
   259  	pulumi.Input
   260  
   261  	ToRepositoryArrayOutput() RepositoryArrayOutput
   262  	ToRepositoryArrayOutputWithContext(context.Context) RepositoryArrayOutput
   263  }
   264  
   265  type RepositoryArray []RepositoryInput
   266  
   267  func (RepositoryArray) ElementType() reflect.Type {
   268  	return reflect.TypeOf((*[]*Repository)(nil)).Elem()
   269  }
   270  
   271  func (i RepositoryArray) ToRepositoryArrayOutput() RepositoryArrayOutput {
   272  	return i.ToRepositoryArrayOutputWithContext(context.Background())
   273  }
   274  
   275  func (i RepositoryArray) ToRepositoryArrayOutputWithContext(ctx context.Context) RepositoryArrayOutput {
   276  	return pulumi.ToOutputWithContext(ctx, i).(RepositoryArrayOutput)
   277  }
   278  
   279  // RepositoryMapInput is an input type that accepts RepositoryMap and RepositoryMapOutput values.
   280  // You can construct a concrete instance of `RepositoryMapInput` via:
   281  //
   282  //	RepositoryMap{ "key": RepositoryArgs{...} }
   283  type RepositoryMapInput interface {
   284  	pulumi.Input
   285  
   286  	ToRepositoryMapOutput() RepositoryMapOutput
   287  	ToRepositoryMapOutputWithContext(context.Context) RepositoryMapOutput
   288  }
   289  
   290  type RepositoryMap map[string]RepositoryInput
   291  
   292  func (RepositoryMap) ElementType() reflect.Type {
   293  	return reflect.TypeOf((*map[string]*Repository)(nil)).Elem()
   294  }
   295  
   296  func (i RepositoryMap) ToRepositoryMapOutput() RepositoryMapOutput {
   297  	return i.ToRepositoryMapOutputWithContext(context.Background())
   298  }
   299  
   300  func (i RepositoryMap) ToRepositoryMapOutputWithContext(ctx context.Context) RepositoryMapOutput {
   301  	return pulumi.ToOutputWithContext(ctx, i).(RepositoryMapOutput)
   302  }
   303  
   304  type RepositoryOutput struct{ *pulumi.OutputState }
   305  
   306  func (RepositoryOutput) ElementType() reflect.Type {
   307  	return reflect.TypeOf((**Repository)(nil)).Elem()
   308  }
   309  
   310  func (o RepositoryOutput) ToRepositoryOutput() RepositoryOutput {
   311  	return o
   312  }
   313  
   314  func (o RepositoryOutput) ToRepositoryOutputWithContext(ctx context.Context) RepositoryOutput {
   315  	return o
   316  }
   317  
   318  // The ARN of the repository
   319  func (o RepositoryOutput) Arn() pulumi.StringOutput {
   320  	return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   321  }
   322  
   323  // The URL to use for cloning the repository over HTTPS.
   324  func (o RepositoryOutput) CloneUrlHttp() pulumi.StringOutput {
   325  	return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.CloneUrlHttp }).(pulumi.StringOutput)
   326  }
   327  
   328  // The URL to use for cloning the repository over SSH.
   329  func (o RepositoryOutput) CloneUrlSsh() pulumi.StringOutput {
   330  	return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.CloneUrlSsh }).(pulumi.StringOutput)
   331  }
   332  
   333  // The default branch of the repository. The branch specified here needs to exist.
   334  func (o RepositoryOutput) DefaultBranch() pulumi.StringPtrOutput {
   335  	return o.ApplyT(func(v *Repository) pulumi.StringPtrOutput { return v.DefaultBranch }).(pulumi.StringPtrOutput)
   336  }
   337  
   338  // The description of the repository. This needs to be less than 1000 characters
   339  func (o RepositoryOutput) Description() pulumi.StringPtrOutput {
   340  	return o.ApplyT(func(v *Repository) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   341  }
   342  
   343  // The ARN of the encryption key. If no key is specified, the default `aws/codecommit“ Amazon Web Services managed key is used.
   344  func (o RepositoryOutput) KmsKeyId() pulumi.StringOutput {
   345  	return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.KmsKeyId }).(pulumi.StringOutput)
   346  }
   347  
   348  // The ID of the repository
   349  func (o RepositoryOutput) RepositoryId() pulumi.StringOutput {
   350  	return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.RepositoryId }).(pulumi.StringOutput)
   351  }
   352  
   353  // The name for the repository. This needs to be less than 100 characters.
   354  func (o RepositoryOutput) RepositoryName() pulumi.StringOutput {
   355  	return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.RepositoryName }).(pulumi.StringOutput)
   356  }
   357  
   358  // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   359  func (o RepositoryOutput) Tags() pulumi.StringMapOutput {
   360  	return o.ApplyT(func(v *Repository) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   361  }
   362  
   363  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   364  //
   365  // Deprecated: Please use `tags` instead.
   366  func (o RepositoryOutput) TagsAll() pulumi.StringMapOutput {
   367  	return o.ApplyT(func(v *Repository) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   368  }
   369  
   370  type RepositoryArrayOutput struct{ *pulumi.OutputState }
   371  
   372  func (RepositoryArrayOutput) ElementType() reflect.Type {
   373  	return reflect.TypeOf((*[]*Repository)(nil)).Elem()
   374  }
   375  
   376  func (o RepositoryArrayOutput) ToRepositoryArrayOutput() RepositoryArrayOutput {
   377  	return o
   378  }
   379  
   380  func (o RepositoryArrayOutput) ToRepositoryArrayOutputWithContext(ctx context.Context) RepositoryArrayOutput {
   381  	return o
   382  }
   383  
   384  func (o RepositoryArrayOutput) Index(i pulumi.IntInput) RepositoryOutput {
   385  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Repository {
   386  		return vs[0].([]*Repository)[vs[1].(int)]
   387  	}).(RepositoryOutput)
   388  }
   389  
   390  type RepositoryMapOutput struct{ *pulumi.OutputState }
   391  
   392  func (RepositoryMapOutput) ElementType() reflect.Type {
   393  	return reflect.TypeOf((*map[string]*Repository)(nil)).Elem()
   394  }
   395  
   396  func (o RepositoryMapOutput) ToRepositoryMapOutput() RepositoryMapOutput {
   397  	return o
   398  }
   399  
   400  func (o RepositoryMapOutput) ToRepositoryMapOutputWithContext(ctx context.Context) RepositoryMapOutput {
   401  	return o
   402  }
   403  
   404  func (o RepositoryMapOutput) MapIndex(k pulumi.StringInput) RepositoryOutput {
   405  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Repository {
   406  		return vs[0].(map[string]*Repository)[vs[1].(string)]
   407  	}).(RepositoryOutput)
   408  }
   409  
   410  func init() {
   411  	pulumi.RegisterInputType(reflect.TypeOf((*RepositoryInput)(nil)).Elem(), &Repository{})
   412  	pulumi.RegisterInputType(reflect.TypeOf((*RepositoryArrayInput)(nil)).Elem(), RepositoryArray{})
   413  	pulumi.RegisterInputType(reflect.TypeOf((*RepositoryMapInput)(nil)).Elem(), RepositoryMap{})
   414  	pulumi.RegisterOutputType(RepositoryOutput{})
   415  	pulumi.RegisterOutputType(RepositoryArrayOutput{})
   416  	pulumi.RegisterOutputType(RepositoryMapOutput{})
   417  }