github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/codeartifact/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 codeartifact
     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 CodeArtifact 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/codeartifact"
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			example, err := kms.NewKey(ctx, "example", &kms.KeyArgs{
    34  //				Description: pulumi.String("domain key"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			exampleDomain, err := codeartifact.NewDomain(ctx, "example", &codeartifact.DomainArgs{
    40  //				Domain:        pulumi.String("example"),
    41  //				EncryptionKey: example.Arn,
    42  //			})
    43  //			if err != nil {
    44  //				return err
    45  //			}
    46  //			_, err = codeartifact.NewRepository(ctx, "test", &codeartifact.RepositoryArgs{
    47  //				Repository: pulumi.String("example"),
    48  //				Domain:     exampleDomain.Domain,
    49  //			})
    50  //			if err != nil {
    51  //				return err
    52  //			}
    53  //			return nil
    54  //		})
    55  //	}
    56  //
    57  // ```
    58  // <!--End PulumiCodeChooser -->
    59  //
    60  // ### With Upstream Repository
    61  //
    62  // <!--Start PulumiCodeChooser -->
    63  // ```go
    64  // package main
    65  //
    66  // import (
    67  //
    68  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codeartifact"
    69  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    70  //
    71  // )
    72  //
    73  //	func main() {
    74  //		pulumi.Run(func(ctx *pulumi.Context) error {
    75  //			upstream, err := codeartifact.NewRepository(ctx, "upstream", &codeartifact.RepositoryArgs{
    76  //				Repository: pulumi.String("upstream"),
    77  //				Domain:     pulumi.Any(testAwsCodeartifactDomain.Domain),
    78  //			})
    79  //			if err != nil {
    80  //				return err
    81  //			}
    82  //			_, err = codeartifact.NewRepository(ctx, "test", &codeartifact.RepositoryArgs{
    83  //				Repository: pulumi.String("example"),
    84  //				Domain:     pulumi.Any(example.Domain),
    85  //				Upstreams: codeartifact.RepositoryUpstreamArray{
    86  //					&codeartifact.RepositoryUpstreamArgs{
    87  //						RepositoryName: upstream.Repository,
    88  //					},
    89  //				},
    90  //			})
    91  //			if err != nil {
    92  //				return err
    93  //			}
    94  //			return nil
    95  //		})
    96  //	}
    97  //
    98  // ```
    99  // <!--End PulumiCodeChooser -->
   100  //
   101  // ### With External Connection
   102  //
   103  // <!--Start PulumiCodeChooser -->
   104  // ```go
   105  // package main
   106  //
   107  // import (
   108  //
   109  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codeartifact"
   110  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   111  //
   112  // )
   113  //
   114  //	func main() {
   115  //		pulumi.Run(func(ctx *pulumi.Context) error {
   116  //			_, err := codeartifact.NewRepository(ctx, "upstream", &codeartifact.RepositoryArgs{
   117  //				Repository: pulumi.String("upstream"),
   118  //				Domain:     pulumi.Any(testAwsCodeartifactDomain.Domain),
   119  //			})
   120  //			if err != nil {
   121  //				return err
   122  //			}
   123  //			_, err = codeartifact.NewRepository(ctx, "test", &codeartifact.RepositoryArgs{
   124  //				Repository: pulumi.String("example"),
   125  //				Domain:     pulumi.Any(example.Domain),
   126  //				ExternalConnections: &codeartifact.RepositoryExternalConnectionsArgs{
   127  //					ExternalConnectionName: pulumi.String("public:npmjs"),
   128  //				},
   129  //			})
   130  //			if err != nil {
   131  //				return err
   132  //			}
   133  //			return nil
   134  //		})
   135  //	}
   136  //
   137  // ```
   138  // <!--End PulumiCodeChooser -->
   139  //
   140  // ## Import
   141  //
   142  // Using `pulumi import`, import CodeArtifact Repository using the CodeArtifact Repository ARN. For example:
   143  //
   144  // ```sh
   145  // $ pulumi import aws:codeartifact/repository:Repository example arn:aws:codeartifact:us-west-2:012345678912:repository/tf-acc-test-6968272603913957763/tf-acc-test-6968272603913957763
   146  // ```
   147  type Repository struct {
   148  	pulumi.CustomResourceState
   149  
   150  	// The account number of the AWS account that manages the repository.
   151  	AdministratorAccount pulumi.StringOutput `pulumi:"administratorAccount"`
   152  	// The ARN of the repository.
   153  	Arn pulumi.StringOutput `pulumi:"arn"`
   154  	// The description of the repository.
   155  	Description pulumi.StringPtrOutput `pulumi:"description"`
   156  	// The domain that contains the created repository.
   157  	Domain pulumi.StringOutput `pulumi:"domain"`
   158  	// The account number of the AWS account that owns the domain.
   159  	DomainOwner pulumi.StringOutput `pulumi:"domainOwner"`
   160  	// An array of external connections associated with the repository. Only one external connection can be set per repository. see External Connections.
   161  	ExternalConnections RepositoryExternalConnectionsPtrOutput `pulumi:"externalConnections"`
   162  	// The name of the repository to create.
   163  	Repository pulumi.StringOutput `pulumi:"repository"`
   164  	// 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.
   165  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   166  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   167  	//
   168  	// Deprecated: Please use `tags` instead.
   169  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   170  	// A list of upstream repositories to associate with the repository. The order of the upstream repositories in the list determines their priority order when AWS CodeArtifact looks for a requested package version. see Upstream
   171  	Upstreams RepositoryUpstreamArrayOutput `pulumi:"upstreams"`
   172  }
   173  
   174  // NewRepository registers a new resource with the given unique name, arguments, and options.
   175  func NewRepository(ctx *pulumi.Context,
   176  	name string, args *RepositoryArgs, opts ...pulumi.ResourceOption) (*Repository, error) {
   177  	if args == nil {
   178  		return nil, errors.New("missing one or more required arguments")
   179  	}
   180  
   181  	if args.Domain == nil {
   182  		return nil, errors.New("invalid value for required argument 'Domain'")
   183  	}
   184  	if args.Repository == nil {
   185  		return nil, errors.New("invalid value for required argument 'Repository'")
   186  	}
   187  	opts = internal.PkgResourceDefaultOpts(opts)
   188  	var resource Repository
   189  	err := ctx.RegisterResource("aws:codeartifact/repository:Repository", name, args, &resource, opts...)
   190  	if err != nil {
   191  		return nil, err
   192  	}
   193  	return &resource, nil
   194  }
   195  
   196  // GetRepository gets an existing Repository resource's state with the given name, ID, and optional
   197  // state properties that are used to uniquely qualify the lookup (nil if not required).
   198  func GetRepository(ctx *pulumi.Context,
   199  	name string, id pulumi.IDInput, state *RepositoryState, opts ...pulumi.ResourceOption) (*Repository, error) {
   200  	var resource Repository
   201  	err := ctx.ReadResource("aws:codeartifact/repository:Repository", name, id, state, &resource, opts...)
   202  	if err != nil {
   203  		return nil, err
   204  	}
   205  	return &resource, nil
   206  }
   207  
   208  // Input properties used for looking up and filtering Repository resources.
   209  type repositoryState struct {
   210  	// The account number of the AWS account that manages the repository.
   211  	AdministratorAccount *string `pulumi:"administratorAccount"`
   212  	// The ARN of the repository.
   213  	Arn *string `pulumi:"arn"`
   214  	// The description of the repository.
   215  	Description *string `pulumi:"description"`
   216  	// The domain that contains the created repository.
   217  	Domain *string `pulumi:"domain"`
   218  	// The account number of the AWS account that owns the domain.
   219  	DomainOwner *string `pulumi:"domainOwner"`
   220  	// An array of external connections associated with the repository. Only one external connection can be set per repository. see External Connections.
   221  	ExternalConnections *RepositoryExternalConnections `pulumi:"externalConnections"`
   222  	// The name of the repository to create.
   223  	Repository *string `pulumi:"repository"`
   224  	// 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.
   225  	Tags map[string]string `pulumi:"tags"`
   226  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   227  	//
   228  	// Deprecated: Please use `tags` instead.
   229  	TagsAll map[string]string `pulumi:"tagsAll"`
   230  	// A list of upstream repositories to associate with the repository. The order of the upstream repositories in the list determines their priority order when AWS CodeArtifact looks for a requested package version. see Upstream
   231  	Upstreams []RepositoryUpstream `pulumi:"upstreams"`
   232  }
   233  
   234  type RepositoryState struct {
   235  	// The account number of the AWS account that manages the repository.
   236  	AdministratorAccount pulumi.StringPtrInput
   237  	// The ARN of the repository.
   238  	Arn pulumi.StringPtrInput
   239  	// The description of the repository.
   240  	Description pulumi.StringPtrInput
   241  	// The domain that contains the created repository.
   242  	Domain pulumi.StringPtrInput
   243  	// The account number of the AWS account that owns the domain.
   244  	DomainOwner pulumi.StringPtrInput
   245  	// An array of external connections associated with the repository. Only one external connection can be set per repository. see External Connections.
   246  	ExternalConnections RepositoryExternalConnectionsPtrInput
   247  	// The name of the repository to create.
   248  	Repository pulumi.StringPtrInput
   249  	// 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.
   250  	Tags pulumi.StringMapInput
   251  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   252  	//
   253  	// Deprecated: Please use `tags` instead.
   254  	TagsAll pulumi.StringMapInput
   255  	// A list of upstream repositories to associate with the repository. The order of the upstream repositories in the list determines their priority order when AWS CodeArtifact looks for a requested package version. see Upstream
   256  	Upstreams RepositoryUpstreamArrayInput
   257  }
   258  
   259  func (RepositoryState) ElementType() reflect.Type {
   260  	return reflect.TypeOf((*repositoryState)(nil)).Elem()
   261  }
   262  
   263  type repositoryArgs struct {
   264  	// The description of the repository.
   265  	Description *string `pulumi:"description"`
   266  	// The domain that contains the created repository.
   267  	Domain string `pulumi:"domain"`
   268  	// The account number of the AWS account that owns the domain.
   269  	DomainOwner *string `pulumi:"domainOwner"`
   270  	// An array of external connections associated with the repository. Only one external connection can be set per repository. see External Connections.
   271  	ExternalConnections *RepositoryExternalConnections `pulumi:"externalConnections"`
   272  	// The name of the repository to create.
   273  	Repository string `pulumi:"repository"`
   274  	// 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.
   275  	Tags map[string]string `pulumi:"tags"`
   276  	// A list of upstream repositories to associate with the repository. The order of the upstream repositories in the list determines their priority order when AWS CodeArtifact looks for a requested package version. see Upstream
   277  	Upstreams []RepositoryUpstream `pulumi:"upstreams"`
   278  }
   279  
   280  // The set of arguments for constructing a Repository resource.
   281  type RepositoryArgs struct {
   282  	// The description of the repository.
   283  	Description pulumi.StringPtrInput
   284  	// The domain that contains the created repository.
   285  	Domain pulumi.StringInput
   286  	// The account number of the AWS account that owns the domain.
   287  	DomainOwner pulumi.StringPtrInput
   288  	// An array of external connections associated with the repository. Only one external connection can be set per repository. see External Connections.
   289  	ExternalConnections RepositoryExternalConnectionsPtrInput
   290  	// The name of the repository to create.
   291  	Repository pulumi.StringInput
   292  	// 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.
   293  	Tags pulumi.StringMapInput
   294  	// A list of upstream repositories to associate with the repository. The order of the upstream repositories in the list determines their priority order when AWS CodeArtifact looks for a requested package version. see Upstream
   295  	Upstreams RepositoryUpstreamArrayInput
   296  }
   297  
   298  func (RepositoryArgs) ElementType() reflect.Type {
   299  	return reflect.TypeOf((*repositoryArgs)(nil)).Elem()
   300  }
   301  
   302  type RepositoryInput interface {
   303  	pulumi.Input
   304  
   305  	ToRepositoryOutput() RepositoryOutput
   306  	ToRepositoryOutputWithContext(ctx context.Context) RepositoryOutput
   307  }
   308  
   309  func (*Repository) ElementType() reflect.Type {
   310  	return reflect.TypeOf((**Repository)(nil)).Elem()
   311  }
   312  
   313  func (i *Repository) ToRepositoryOutput() RepositoryOutput {
   314  	return i.ToRepositoryOutputWithContext(context.Background())
   315  }
   316  
   317  func (i *Repository) ToRepositoryOutputWithContext(ctx context.Context) RepositoryOutput {
   318  	return pulumi.ToOutputWithContext(ctx, i).(RepositoryOutput)
   319  }
   320  
   321  // RepositoryArrayInput is an input type that accepts RepositoryArray and RepositoryArrayOutput values.
   322  // You can construct a concrete instance of `RepositoryArrayInput` via:
   323  //
   324  //	RepositoryArray{ RepositoryArgs{...} }
   325  type RepositoryArrayInput interface {
   326  	pulumi.Input
   327  
   328  	ToRepositoryArrayOutput() RepositoryArrayOutput
   329  	ToRepositoryArrayOutputWithContext(context.Context) RepositoryArrayOutput
   330  }
   331  
   332  type RepositoryArray []RepositoryInput
   333  
   334  func (RepositoryArray) ElementType() reflect.Type {
   335  	return reflect.TypeOf((*[]*Repository)(nil)).Elem()
   336  }
   337  
   338  func (i RepositoryArray) ToRepositoryArrayOutput() RepositoryArrayOutput {
   339  	return i.ToRepositoryArrayOutputWithContext(context.Background())
   340  }
   341  
   342  func (i RepositoryArray) ToRepositoryArrayOutputWithContext(ctx context.Context) RepositoryArrayOutput {
   343  	return pulumi.ToOutputWithContext(ctx, i).(RepositoryArrayOutput)
   344  }
   345  
   346  // RepositoryMapInput is an input type that accepts RepositoryMap and RepositoryMapOutput values.
   347  // You can construct a concrete instance of `RepositoryMapInput` via:
   348  //
   349  //	RepositoryMap{ "key": RepositoryArgs{...} }
   350  type RepositoryMapInput interface {
   351  	pulumi.Input
   352  
   353  	ToRepositoryMapOutput() RepositoryMapOutput
   354  	ToRepositoryMapOutputWithContext(context.Context) RepositoryMapOutput
   355  }
   356  
   357  type RepositoryMap map[string]RepositoryInput
   358  
   359  func (RepositoryMap) ElementType() reflect.Type {
   360  	return reflect.TypeOf((*map[string]*Repository)(nil)).Elem()
   361  }
   362  
   363  func (i RepositoryMap) ToRepositoryMapOutput() RepositoryMapOutput {
   364  	return i.ToRepositoryMapOutputWithContext(context.Background())
   365  }
   366  
   367  func (i RepositoryMap) ToRepositoryMapOutputWithContext(ctx context.Context) RepositoryMapOutput {
   368  	return pulumi.ToOutputWithContext(ctx, i).(RepositoryMapOutput)
   369  }
   370  
   371  type RepositoryOutput struct{ *pulumi.OutputState }
   372  
   373  func (RepositoryOutput) ElementType() reflect.Type {
   374  	return reflect.TypeOf((**Repository)(nil)).Elem()
   375  }
   376  
   377  func (o RepositoryOutput) ToRepositoryOutput() RepositoryOutput {
   378  	return o
   379  }
   380  
   381  func (o RepositoryOutput) ToRepositoryOutputWithContext(ctx context.Context) RepositoryOutput {
   382  	return o
   383  }
   384  
   385  // The account number of the AWS account that manages the repository.
   386  func (o RepositoryOutput) AdministratorAccount() pulumi.StringOutput {
   387  	return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.AdministratorAccount }).(pulumi.StringOutput)
   388  }
   389  
   390  // The ARN of the repository.
   391  func (o RepositoryOutput) Arn() pulumi.StringOutput {
   392  	return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   393  }
   394  
   395  // The description of the repository.
   396  func (o RepositoryOutput) Description() pulumi.StringPtrOutput {
   397  	return o.ApplyT(func(v *Repository) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   398  }
   399  
   400  // The domain that contains the created repository.
   401  func (o RepositoryOutput) Domain() pulumi.StringOutput {
   402  	return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.Domain }).(pulumi.StringOutput)
   403  }
   404  
   405  // The account number of the AWS account that owns the domain.
   406  func (o RepositoryOutput) DomainOwner() pulumi.StringOutput {
   407  	return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.DomainOwner }).(pulumi.StringOutput)
   408  }
   409  
   410  // An array of external connections associated with the repository. Only one external connection can be set per repository. see External Connections.
   411  func (o RepositoryOutput) ExternalConnections() RepositoryExternalConnectionsPtrOutput {
   412  	return o.ApplyT(func(v *Repository) RepositoryExternalConnectionsPtrOutput { return v.ExternalConnections }).(RepositoryExternalConnectionsPtrOutput)
   413  }
   414  
   415  // The name of the repository to create.
   416  func (o RepositoryOutput) Repository() pulumi.StringOutput {
   417  	return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.Repository }).(pulumi.StringOutput)
   418  }
   419  
   420  // 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.
   421  func (o RepositoryOutput) Tags() pulumi.StringMapOutput {
   422  	return o.ApplyT(func(v *Repository) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   423  }
   424  
   425  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   426  //
   427  // Deprecated: Please use `tags` instead.
   428  func (o RepositoryOutput) TagsAll() pulumi.StringMapOutput {
   429  	return o.ApplyT(func(v *Repository) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   430  }
   431  
   432  // A list of upstream repositories to associate with the repository. The order of the upstream repositories in the list determines their priority order when AWS CodeArtifact looks for a requested package version. see Upstream
   433  func (o RepositoryOutput) Upstreams() RepositoryUpstreamArrayOutput {
   434  	return o.ApplyT(func(v *Repository) RepositoryUpstreamArrayOutput { return v.Upstreams }).(RepositoryUpstreamArrayOutput)
   435  }
   436  
   437  type RepositoryArrayOutput struct{ *pulumi.OutputState }
   438  
   439  func (RepositoryArrayOutput) ElementType() reflect.Type {
   440  	return reflect.TypeOf((*[]*Repository)(nil)).Elem()
   441  }
   442  
   443  func (o RepositoryArrayOutput) ToRepositoryArrayOutput() RepositoryArrayOutput {
   444  	return o
   445  }
   446  
   447  func (o RepositoryArrayOutput) ToRepositoryArrayOutputWithContext(ctx context.Context) RepositoryArrayOutput {
   448  	return o
   449  }
   450  
   451  func (o RepositoryArrayOutput) Index(i pulumi.IntInput) RepositoryOutput {
   452  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Repository {
   453  		return vs[0].([]*Repository)[vs[1].(int)]
   454  	}).(RepositoryOutput)
   455  }
   456  
   457  type RepositoryMapOutput struct{ *pulumi.OutputState }
   458  
   459  func (RepositoryMapOutput) ElementType() reflect.Type {
   460  	return reflect.TypeOf((*map[string]*Repository)(nil)).Elem()
   461  }
   462  
   463  func (o RepositoryMapOutput) ToRepositoryMapOutput() RepositoryMapOutput {
   464  	return o
   465  }
   466  
   467  func (o RepositoryMapOutput) ToRepositoryMapOutputWithContext(ctx context.Context) RepositoryMapOutput {
   468  	return o
   469  }
   470  
   471  func (o RepositoryMapOutput) MapIndex(k pulumi.StringInput) RepositoryOutput {
   472  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Repository {
   473  		return vs[0].(map[string]*Repository)[vs[1].(string)]
   474  	}).(RepositoryOutput)
   475  }
   476  
   477  func init() {
   478  	pulumi.RegisterInputType(reflect.TypeOf((*RepositoryInput)(nil)).Elem(), &Repository{})
   479  	pulumi.RegisterInputType(reflect.TypeOf((*RepositoryArrayInput)(nil)).Elem(), RepositoryArray{})
   480  	pulumi.RegisterInputType(reflect.TypeOf((*RepositoryMapInput)(nil)).Elem(), RepositoryMap{})
   481  	pulumi.RegisterOutputType(RepositoryOutput{})
   482  	pulumi.RegisterOutputType(RepositoryArrayOutput{})
   483  	pulumi.RegisterOutputType(RepositoryMapOutput{})
   484  }