github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/sagemaker/codeRepository.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 sagemaker
     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 SageMaker Code Repository resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sagemaker"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := sagemaker.NewCodeRepository(ctx, "example", &sagemaker.CodeRepositoryArgs{
    35  //				CodeRepositoryName: pulumi.String("example"),
    36  //				GitConfig: &sagemaker.CodeRepositoryGitConfigArgs{
    37  //					RepositoryUrl: pulumi.String("https://github.com/github/docs.git"),
    38  //				},
    39  //			})
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			return nil
    44  //		})
    45  //	}
    46  //
    47  // ```
    48  // <!--End PulumiCodeChooser -->
    49  //
    50  // ### Example with Secret
    51  //
    52  // <!--Start PulumiCodeChooser -->
    53  // ```go
    54  // package main
    55  //
    56  // import (
    57  //
    58  //	"encoding/json"
    59  //
    60  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sagemaker"
    61  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/secretsmanager"
    62  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    63  //
    64  // )
    65  //
    66  //	func main() {
    67  //		pulumi.Run(func(ctx *pulumi.Context) error {
    68  //			example, err := secretsmanager.NewSecret(ctx, "example", &secretsmanager.SecretArgs{
    69  //				Name: pulumi.String("example"),
    70  //			})
    71  //			if err != nil {
    72  //				return err
    73  //			}
    74  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    75  //				"username": "example",
    76  //				"password": "example",
    77  //			})
    78  //			if err != nil {
    79  //				return err
    80  //			}
    81  //			json0 := string(tmpJSON0)
    82  //			exampleSecretVersion, err := secretsmanager.NewSecretVersion(ctx, "example", &secretsmanager.SecretVersionArgs{
    83  //				SecretId:     example.ID(),
    84  //				SecretString: pulumi.String(json0),
    85  //			})
    86  //			if err != nil {
    87  //				return err
    88  //			}
    89  //			_, err = sagemaker.NewCodeRepository(ctx, "example", &sagemaker.CodeRepositoryArgs{
    90  //				CodeRepositoryName: pulumi.String("example"),
    91  //				GitConfig: &sagemaker.CodeRepositoryGitConfigArgs{
    92  //					RepositoryUrl: pulumi.String("https://github.com/github/docs.git"),
    93  //					SecretArn:     example.Arn,
    94  //				},
    95  //			}, pulumi.DependsOn([]pulumi.Resource{
    96  //				exampleSecretVersion,
    97  //			}))
    98  //			if err != nil {
    99  //				return err
   100  //			}
   101  //			return nil
   102  //		})
   103  //	}
   104  //
   105  // ```
   106  // <!--End PulumiCodeChooser -->
   107  //
   108  // ## Import
   109  //
   110  // Using `pulumi import`, import SageMaker Code Repositories using the `name`. For example:
   111  //
   112  // ```sh
   113  // $ pulumi import aws:sagemaker/codeRepository:CodeRepository test_code_repository my-code-repo
   114  // ```
   115  type CodeRepository struct {
   116  	pulumi.CustomResourceState
   117  
   118  	// The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
   119  	Arn pulumi.StringOutput `pulumi:"arn"`
   120  	// The name of the Code Repository (must be unique).
   121  	CodeRepositoryName pulumi.StringOutput `pulumi:"codeRepositoryName"`
   122  	// Specifies details about the repository. see Git Config details below.
   123  	GitConfig CodeRepositoryGitConfigOutput `pulumi:"gitConfig"`
   124  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   125  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   126  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   127  	//
   128  	// Deprecated: Please use `tags` instead.
   129  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   130  }
   131  
   132  // NewCodeRepository registers a new resource with the given unique name, arguments, and options.
   133  func NewCodeRepository(ctx *pulumi.Context,
   134  	name string, args *CodeRepositoryArgs, opts ...pulumi.ResourceOption) (*CodeRepository, error) {
   135  	if args == nil {
   136  		return nil, errors.New("missing one or more required arguments")
   137  	}
   138  
   139  	if args.CodeRepositoryName == nil {
   140  		return nil, errors.New("invalid value for required argument 'CodeRepositoryName'")
   141  	}
   142  	if args.GitConfig == nil {
   143  		return nil, errors.New("invalid value for required argument 'GitConfig'")
   144  	}
   145  	opts = internal.PkgResourceDefaultOpts(opts)
   146  	var resource CodeRepository
   147  	err := ctx.RegisterResource("aws:sagemaker/codeRepository:CodeRepository", name, args, &resource, opts...)
   148  	if err != nil {
   149  		return nil, err
   150  	}
   151  	return &resource, nil
   152  }
   153  
   154  // GetCodeRepository gets an existing CodeRepository resource's state with the given name, ID, and optional
   155  // state properties that are used to uniquely qualify the lookup (nil if not required).
   156  func GetCodeRepository(ctx *pulumi.Context,
   157  	name string, id pulumi.IDInput, state *CodeRepositoryState, opts ...pulumi.ResourceOption) (*CodeRepository, error) {
   158  	var resource CodeRepository
   159  	err := ctx.ReadResource("aws:sagemaker/codeRepository:CodeRepository", name, id, state, &resource, opts...)
   160  	if err != nil {
   161  		return nil, err
   162  	}
   163  	return &resource, nil
   164  }
   165  
   166  // Input properties used for looking up and filtering CodeRepository resources.
   167  type codeRepositoryState struct {
   168  	// The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
   169  	Arn *string `pulumi:"arn"`
   170  	// The name of the Code Repository (must be unique).
   171  	CodeRepositoryName *string `pulumi:"codeRepositoryName"`
   172  	// Specifies details about the repository. see Git Config details below.
   173  	GitConfig *CodeRepositoryGitConfig `pulumi:"gitConfig"`
   174  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   175  	Tags map[string]string `pulumi:"tags"`
   176  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   177  	//
   178  	// Deprecated: Please use `tags` instead.
   179  	TagsAll map[string]string `pulumi:"tagsAll"`
   180  }
   181  
   182  type CodeRepositoryState struct {
   183  	// The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
   184  	Arn pulumi.StringPtrInput
   185  	// The name of the Code Repository (must be unique).
   186  	CodeRepositoryName pulumi.StringPtrInput
   187  	// Specifies details about the repository. see Git Config details below.
   188  	GitConfig CodeRepositoryGitConfigPtrInput
   189  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   190  	Tags pulumi.StringMapInput
   191  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   192  	//
   193  	// Deprecated: Please use `tags` instead.
   194  	TagsAll pulumi.StringMapInput
   195  }
   196  
   197  func (CodeRepositoryState) ElementType() reflect.Type {
   198  	return reflect.TypeOf((*codeRepositoryState)(nil)).Elem()
   199  }
   200  
   201  type codeRepositoryArgs struct {
   202  	// The name of the Code Repository (must be unique).
   203  	CodeRepositoryName string `pulumi:"codeRepositoryName"`
   204  	// Specifies details about the repository. see Git Config details below.
   205  	GitConfig CodeRepositoryGitConfig `pulumi:"gitConfig"`
   206  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   207  	Tags map[string]string `pulumi:"tags"`
   208  }
   209  
   210  // The set of arguments for constructing a CodeRepository resource.
   211  type CodeRepositoryArgs struct {
   212  	// The name of the Code Repository (must be unique).
   213  	CodeRepositoryName pulumi.StringInput
   214  	// Specifies details about the repository. see Git Config details below.
   215  	GitConfig CodeRepositoryGitConfigInput
   216  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   217  	Tags pulumi.StringMapInput
   218  }
   219  
   220  func (CodeRepositoryArgs) ElementType() reflect.Type {
   221  	return reflect.TypeOf((*codeRepositoryArgs)(nil)).Elem()
   222  }
   223  
   224  type CodeRepositoryInput interface {
   225  	pulumi.Input
   226  
   227  	ToCodeRepositoryOutput() CodeRepositoryOutput
   228  	ToCodeRepositoryOutputWithContext(ctx context.Context) CodeRepositoryOutput
   229  }
   230  
   231  func (*CodeRepository) ElementType() reflect.Type {
   232  	return reflect.TypeOf((**CodeRepository)(nil)).Elem()
   233  }
   234  
   235  func (i *CodeRepository) ToCodeRepositoryOutput() CodeRepositoryOutput {
   236  	return i.ToCodeRepositoryOutputWithContext(context.Background())
   237  }
   238  
   239  func (i *CodeRepository) ToCodeRepositoryOutputWithContext(ctx context.Context) CodeRepositoryOutput {
   240  	return pulumi.ToOutputWithContext(ctx, i).(CodeRepositoryOutput)
   241  }
   242  
   243  // CodeRepositoryArrayInput is an input type that accepts CodeRepositoryArray and CodeRepositoryArrayOutput values.
   244  // You can construct a concrete instance of `CodeRepositoryArrayInput` via:
   245  //
   246  //	CodeRepositoryArray{ CodeRepositoryArgs{...} }
   247  type CodeRepositoryArrayInput interface {
   248  	pulumi.Input
   249  
   250  	ToCodeRepositoryArrayOutput() CodeRepositoryArrayOutput
   251  	ToCodeRepositoryArrayOutputWithContext(context.Context) CodeRepositoryArrayOutput
   252  }
   253  
   254  type CodeRepositoryArray []CodeRepositoryInput
   255  
   256  func (CodeRepositoryArray) ElementType() reflect.Type {
   257  	return reflect.TypeOf((*[]*CodeRepository)(nil)).Elem()
   258  }
   259  
   260  func (i CodeRepositoryArray) ToCodeRepositoryArrayOutput() CodeRepositoryArrayOutput {
   261  	return i.ToCodeRepositoryArrayOutputWithContext(context.Background())
   262  }
   263  
   264  func (i CodeRepositoryArray) ToCodeRepositoryArrayOutputWithContext(ctx context.Context) CodeRepositoryArrayOutput {
   265  	return pulumi.ToOutputWithContext(ctx, i).(CodeRepositoryArrayOutput)
   266  }
   267  
   268  // CodeRepositoryMapInput is an input type that accepts CodeRepositoryMap and CodeRepositoryMapOutput values.
   269  // You can construct a concrete instance of `CodeRepositoryMapInput` via:
   270  //
   271  //	CodeRepositoryMap{ "key": CodeRepositoryArgs{...} }
   272  type CodeRepositoryMapInput interface {
   273  	pulumi.Input
   274  
   275  	ToCodeRepositoryMapOutput() CodeRepositoryMapOutput
   276  	ToCodeRepositoryMapOutputWithContext(context.Context) CodeRepositoryMapOutput
   277  }
   278  
   279  type CodeRepositoryMap map[string]CodeRepositoryInput
   280  
   281  func (CodeRepositoryMap) ElementType() reflect.Type {
   282  	return reflect.TypeOf((*map[string]*CodeRepository)(nil)).Elem()
   283  }
   284  
   285  func (i CodeRepositoryMap) ToCodeRepositoryMapOutput() CodeRepositoryMapOutput {
   286  	return i.ToCodeRepositoryMapOutputWithContext(context.Background())
   287  }
   288  
   289  func (i CodeRepositoryMap) ToCodeRepositoryMapOutputWithContext(ctx context.Context) CodeRepositoryMapOutput {
   290  	return pulumi.ToOutputWithContext(ctx, i).(CodeRepositoryMapOutput)
   291  }
   292  
   293  type CodeRepositoryOutput struct{ *pulumi.OutputState }
   294  
   295  func (CodeRepositoryOutput) ElementType() reflect.Type {
   296  	return reflect.TypeOf((**CodeRepository)(nil)).Elem()
   297  }
   298  
   299  func (o CodeRepositoryOutput) ToCodeRepositoryOutput() CodeRepositoryOutput {
   300  	return o
   301  }
   302  
   303  func (o CodeRepositoryOutput) ToCodeRepositoryOutputWithContext(ctx context.Context) CodeRepositoryOutput {
   304  	return o
   305  }
   306  
   307  // The Amazon Resource Name (ARN) assigned by AWS to this Code Repository.
   308  func (o CodeRepositoryOutput) Arn() pulumi.StringOutput {
   309  	return o.ApplyT(func(v *CodeRepository) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   310  }
   311  
   312  // The name of the Code Repository (must be unique).
   313  func (o CodeRepositoryOutput) CodeRepositoryName() pulumi.StringOutput {
   314  	return o.ApplyT(func(v *CodeRepository) pulumi.StringOutput { return v.CodeRepositoryName }).(pulumi.StringOutput)
   315  }
   316  
   317  // Specifies details about the repository. see Git Config details below.
   318  func (o CodeRepositoryOutput) GitConfig() CodeRepositoryGitConfigOutput {
   319  	return o.ApplyT(func(v *CodeRepository) CodeRepositoryGitConfigOutput { return v.GitConfig }).(CodeRepositoryGitConfigOutput)
   320  }
   321  
   322  // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   323  func (o CodeRepositoryOutput) Tags() pulumi.StringMapOutput {
   324  	return o.ApplyT(func(v *CodeRepository) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   325  }
   326  
   327  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   328  //
   329  // Deprecated: Please use `tags` instead.
   330  func (o CodeRepositoryOutput) TagsAll() pulumi.StringMapOutput {
   331  	return o.ApplyT(func(v *CodeRepository) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   332  }
   333  
   334  type CodeRepositoryArrayOutput struct{ *pulumi.OutputState }
   335  
   336  func (CodeRepositoryArrayOutput) ElementType() reflect.Type {
   337  	return reflect.TypeOf((*[]*CodeRepository)(nil)).Elem()
   338  }
   339  
   340  func (o CodeRepositoryArrayOutput) ToCodeRepositoryArrayOutput() CodeRepositoryArrayOutput {
   341  	return o
   342  }
   343  
   344  func (o CodeRepositoryArrayOutput) ToCodeRepositoryArrayOutputWithContext(ctx context.Context) CodeRepositoryArrayOutput {
   345  	return o
   346  }
   347  
   348  func (o CodeRepositoryArrayOutput) Index(i pulumi.IntInput) CodeRepositoryOutput {
   349  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CodeRepository {
   350  		return vs[0].([]*CodeRepository)[vs[1].(int)]
   351  	}).(CodeRepositoryOutput)
   352  }
   353  
   354  type CodeRepositoryMapOutput struct{ *pulumi.OutputState }
   355  
   356  func (CodeRepositoryMapOutput) ElementType() reflect.Type {
   357  	return reflect.TypeOf((*map[string]*CodeRepository)(nil)).Elem()
   358  }
   359  
   360  func (o CodeRepositoryMapOutput) ToCodeRepositoryMapOutput() CodeRepositoryMapOutput {
   361  	return o
   362  }
   363  
   364  func (o CodeRepositoryMapOutput) ToCodeRepositoryMapOutputWithContext(ctx context.Context) CodeRepositoryMapOutput {
   365  	return o
   366  }
   367  
   368  func (o CodeRepositoryMapOutput) MapIndex(k pulumi.StringInput) CodeRepositoryOutput {
   369  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CodeRepository {
   370  		return vs[0].(map[string]*CodeRepository)[vs[1].(string)]
   371  	}).(CodeRepositoryOutput)
   372  }
   373  
   374  func init() {
   375  	pulumi.RegisterInputType(reflect.TypeOf((*CodeRepositoryInput)(nil)).Elem(), &CodeRepository{})
   376  	pulumi.RegisterInputType(reflect.TypeOf((*CodeRepositoryArrayInput)(nil)).Elem(), CodeRepositoryArray{})
   377  	pulumi.RegisterInputType(reflect.TypeOf((*CodeRepositoryMapInput)(nil)).Elem(), CodeRepositoryMap{})
   378  	pulumi.RegisterOutputType(CodeRepositoryOutput{})
   379  	pulumi.RegisterOutputType(CodeRepositoryArrayOutput{})
   380  	pulumi.RegisterOutputType(CodeRepositoryMapOutput{})
   381  }