github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/sagemaker/workforce.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 Workforce resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Cognito Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito"
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sagemaker"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			exampleUserPool, err := cognito.NewUserPool(ctx, "example", &cognito.UserPoolArgs{
    36  //				Name: pulumi.String("example"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			exampleUserPoolClient, err := cognito.NewUserPoolClient(ctx, "example", &cognito.UserPoolClientArgs{
    42  //				Name:           pulumi.String("example"),
    43  //				GenerateSecret: pulumi.Bool(true),
    44  //				UserPoolId:     exampleUserPool.ID(),
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			exampleUserPoolDomain, err := cognito.NewUserPoolDomain(ctx, "example", &cognito.UserPoolDomainArgs{
    50  //				Domain:     pulumi.String("example"),
    51  //				UserPoolId: exampleUserPool.ID(),
    52  //			})
    53  //			if err != nil {
    54  //				return err
    55  //			}
    56  //			_, err = sagemaker.NewWorkforce(ctx, "example", &sagemaker.WorkforceArgs{
    57  //				WorkforceName: pulumi.String("example"),
    58  //				CognitoConfig: &sagemaker.WorkforceCognitoConfigArgs{
    59  //					ClientId: exampleUserPoolClient.ID(),
    60  //					UserPool: exampleUserPoolDomain.UserPoolId,
    61  //				},
    62  //			})
    63  //			if err != nil {
    64  //				return err
    65  //			}
    66  //			return nil
    67  //		})
    68  //	}
    69  //
    70  // ```
    71  // <!--End PulumiCodeChooser -->
    72  //
    73  // ### Oidc Usage
    74  //
    75  // <!--Start PulumiCodeChooser -->
    76  // ```go
    77  // package main
    78  //
    79  // import (
    80  //
    81  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sagemaker"
    82  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    83  //
    84  // )
    85  //
    86  //	func main() {
    87  //		pulumi.Run(func(ctx *pulumi.Context) error {
    88  //			_, err := sagemaker.NewWorkforce(ctx, "example", &sagemaker.WorkforceArgs{
    89  //				WorkforceName: pulumi.String("example"),
    90  //				OidcConfig: &sagemaker.WorkforceOidcConfigArgs{
    91  //					AuthorizationEndpoint: pulumi.String("https://example.com"),
    92  //					ClientId:              pulumi.String("example"),
    93  //					ClientSecret:          pulumi.String("example"),
    94  //					Issuer:                pulumi.String("https://example.com"),
    95  //					JwksUri:               pulumi.String("https://example.com"),
    96  //					LogoutEndpoint:        pulumi.String("https://example.com"),
    97  //					TokenEndpoint:         pulumi.String("https://example.com"),
    98  //					UserInfoEndpoint:      pulumi.String("https://example.com"),
    99  //				},
   100  //			})
   101  //			if err != nil {
   102  //				return err
   103  //			}
   104  //			return nil
   105  //		})
   106  //	}
   107  //
   108  // ```
   109  // <!--End PulumiCodeChooser -->
   110  //
   111  // ## Import
   112  //
   113  // Using `pulumi import`, import SageMaker Workforces using the `workforce_name`. For example:
   114  //
   115  // ```sh
   116  // $ pulumi import aws:sagemaker/workforce:Workforce example example
   117  // ```
   118  type Workforce struct {
   119  	pulumi.CustomResourceState
   120  
   121  	// The Amazon Resource Name (ARN) assigned by AWS to this Workforce.
   122  	Arn pulumi.StringOutput `pulumi:"arn"`
   123  	// Use this parameter to configure an Amazon Cognito private workforce. A single Cognito workforce is created using and corresponds to a single Amazon Cognito user pool. Conflicts with `oidcConfig`. see Cognito Config details below.
   124  	CognitoConfig WorkforceCognitoConfigPtrOutput `pulumi:"cognitoConfig"`
   125  	// Use this parameter to configure a private workforce using your own OIDC Identity Provider. Conflicts with `cognitoConfig`. see OIDC Config details below.
   126  	OidcConfig WorkforceOidcConfigPtrOutput `pulumi:"oidcConfig"`
   127  	// A list of IP address ranges Used to create an allow list of IP addresses for a private workforce. By default, a workforce isn't restricted to specific IP addresses. see Source Ip Config details below.
   128  	SourceIpConfig WorkforceSourceIpConfigOutput `pulumi:"sourceIpConfig"`
   129  	// The subdomain for your OIDC Identity Provider.
   130  	Subdomain pulumi.StringOutput `pulumi:"subdomain"`
   131  	// The name of the Workforce (must be unique).
   132  	WorkforceName pulumi.StringOutput `pulumi:"workforceName"`
   133  	// configure a workforce using VPC. see Workforce VPC Config details below.
   134  	WorkforceVpcConfig WorkforceWorkforceVpcConfigPtrOutput `pulumi:"workforceVpcConfig"`
   135  }
   136  
   137  // NewWorkforce registers a new resource with the given unique name, arguments, and options.
   138  func NewWorkforce(ctx *pulumi.Context,
   139  	name string, args *WorkforceArgs, opts ...pulumi.ResourceOption) (*Workforce, error) {
   140  	if args == nil {
   141  		return nil, errors.New("missing one or more required arguments")
   142  	}
   143  
   144  	if args.WorkforceName == nil {
   145  		return nil, errors.New("invalid value for required argument 'WorkforceName'")
   146  	}
   147  	opts = internal.PkgResourceDefaultOpts(opts)
   148  	var resource Workforce
   149  	err := ctx.RegisterResource("aws:sagemaker/workforce:Workforce", name, args, &resource, opts...)
   150  	if err != nil {
   151  		return nil, err
   152  	}
   153  	return &resource, nil
   154  }
   155  
   156  // GetWorkforce gets an existing Workforce resource's state with the given name, ID, and optional
   157  // state properties that are used to uniquely qualify the lookup (nil if not required).
   158  func GetWorkforce(ctx *pulumi.Context,
   159  	name string, id pulumi.IDInput, state *WorkforceState, opts ...pulumi.ResourceOption) (*Workforce, error) {
   160  	var resource Workforce
   161  	err := ctx.ReadResource("aws:sagemaker/workforce:Workforce", name, id, state, &resource, opts...)
   162  	if err != nil {
   163  		return nil, err
   164  	}
   165  	return &resource, nil
   166  }
   167  
   168  // Input properties used for looking up and filtering Workforce resources.
   169  type workforceState struct {
   170  	// The Amazon Resource Name (ARN) assigned by AWS to this Workforce.
   171  	Arn *string `pulumi:"arn"`
   172  	// Use this parameter to configure an Amazon Cognito private workforce. A single Cognito workforce is created using and corresponds to a single Amazon Cognito user pool. Conflicts with `oidcConfig`. see Cognito Config details below.
   173  	CognitoConfig *WorkforceCognitoConfig `pulumi:"cognitoConfig"`
   174  	// Use this parameter to configure a private workforce using your own OIDC Identity Provider. Conflicts with `cognitoConfig`. see OIDC Config details below.
   175  	OidcConfig *WorkforceOidcConfig `pulumi:"oidcConfig"`
   176  	// A list of IP address ranges Used to create an allow list of IP addresses for a private workforce. By default, a workforce isn't restricted to specific IP addresses. see Source Ip Config details below.
   177  	SourceIpConfig *WorkforceSourceIpConfig `pulumi:"sourceIpConfig"`
   178  	// The subdomain for your OIDC Identity Provider.
   179  	Subdomain *string `pulumi:"subdomain"`
   180  	// The name of the Workforce (must be unique).
   181  	WorkforceName *string `pulumi:"workforceName"`
   182  	// configure a workforce using VPC. see Workforce VPC Config details below.
   183  	WorkforceVpcConfig *WorkforceWorkforceVpcConfig `pulumi:"workforceVpcConfig"`
   184  }
   185  
   186  type WorkforceState struct {
   187  	// The Amazon Resource Name (ARN) assigned by AWS to this Workforce.
   188  	Arn pulumi.StringPtrInput
   189  	// Use this parameter to configure an Amazon Cognito private workforce. A single Cognito workforce is created using and corresponds to a single Amazon Cognito user pool. Conflicts with `oidcConfig`. see Cognito Config details below.
   190  	CognitoConfig WorkforceCognitoConfigPtrInput
   191  	// Use this parameter to configure a private workforce using your own OIDC Identity Provider. Conflicts with `cognitoConfig`. see OIDC Config details below.
   192  	OidcConfig WorkforceOidcConfigPtrInput
   193  	// A list of IP address ranges Used to create an allow list of IP addresses for a private workforce. By default, a workforce isn't restricted to specific IP addresses. see Source Ip Config details below.
   194  	SourceIpConfig WorkforceSourceIpConfigPtrInput
   195  	// The subdomain for your OIDC Identity Provider.
   196  	Subdomain pulumi.StringPtrInput
   197  	// The name of the Workforce (must be unique).
   198  	WorkforceName pulumi.StringPtrInput
   199  	// configure a workforce using VPC. see Workforce VPC Config details below.
   200  	WorkforceVpcConfig WorkforceWorkforceVpcConfigPtrInput
   201  }
   202  
   203  func (WorkforceState) ElementType() reflect.Type {
   204  	return reflect.TypeOf((*workforceState)(nil)).Elem()
   205  }
   206  
   207  type workforceArgs struct {
   208  	// Use this parameter to configure an Amazon Cognito private workforce. A single Cognito workforce is created using and corresponds to a single Amazon Cognito user pool. Conflicts with `oidcConfig`. see Cognito Config details below.
   209  	CognitoConfig *WorkforceCognitoConfig `pulumi:"cognitoConfig"`
   210  	// Use this parameter to configure a private workforce using your own OIDC Identity Provider. Conflicts with `cognitoConfig`. see OIDC Config details below.
   211  	OidcConfig *WorkforceOidcConfig `pulumi:"oidcConfig"`
   212  	// A list of IP address ranges Used to create an allow list of IP addresses for a private workforce. By default, a workforce isn't restricted to specific IP addresses. see Source Ip Config details below.
   213  	SourceIpConfig *WorkforceSourceIpConfig `pulumi:"sourceIpConfig"`
   214  	// The name of the Workforce (must be unique).
   215  	WorkforceName string `pulumi:"workforceName"`
   216  	// configure a workforce using VPC. see Workforce VPC Config details below.
   217  	WorkforceVpcConfig *WorkforceWorkforceVpcConfig `pulumi:"workforceVpcConfig"`
   218  }
   219  
   220  // The set of arguments for constructing a Workforce resource.
   221  type WorkforceArgs struct {
   222  	// Use this parameter to configure an Amazon Cognito private workforce. A single Cognito workforce is created using and corresponds to a single Amazon Cognito user pool. Conflicts with `oidcConfig`. see Cognito Config details below.
   223  	CognitoConfig WorkforceCognitoConfigPtrInput
   224  	// Use this parameter to configure a private workforce using your own OIDC Identity Provider. Conflicts with `cognitoConfig`. see OIDC Config details below.
   225  	OidcConfig WorkforceOidcConfigPtrInput
   226  	// A list of IP address ranges Used to create an allow list of IP addresses for a private workforce. By default, a workforce isn't restricted to specific IP addresses. see Source Ip Config details below.
   227  	SourceIpConfig WorkforceSourceIpConfigPtrInput
   228  	// The name of the Workforce (must be unique).
   229  	WorkforceName pulumi.StringInput
   230  	// configure a workforce using VPC. see Workforce VPC Config details below.
   231  	WorkforceVpcConfig WorkforceWorkforceVpcConfigPtrInput
   232  }
   233  
   234  func (WorkforceArgs) ElementType() reflect.Type {
   235  	return reflect.TypeOf((*workforceArgs)(nil)).Elem()
   236  }
   237  
   238  type WorkforceInput interface {
   239  	pulumi.Input
   240  
   241  	ToWorkforceOutput() WorkforceOutput
   242  	ToWorkforceOutputWithContext(ctx context.Context) WorkforceOutput
   243  }
   244  
   245  func (*Workforce) ElementType() reflect.Type {
   246  	return reflect.TypeOf((**Workforce)(nil)).Elem()
   247  }
   248  
   249  func (i *Workforce) ToWorkforceOutput() WorkforceOutput {
   250  	return i.ToWorkforceOutputWithContext(context.Background())
   251  }
   252  
   253  func (i *Workforce) ToWorkforceOutputWithContext(ctx context.Context) WorkforceOutput {
   254  	return pulumi.ToOutputWithContext(ctx, i).(WorkforceOutput)
   255  }
   256  
   257  // WorkforceArrayInput is an input type that accepts WorkforceArray and WorkforceArrayOutput values.
   258  // You can construct a concrete instance of `WorkforceArrayInput` via:
   259  //
   260  //	WorkforceArray{ WorkforceArgs{...} }
   261  type WorkforceArrayInput interface {
   262  	pulumi.Input
   263  
   264  	ToWorkforceArrayOutput() WorkforceArrayOutput
   265  	ToWorkforceArrayOutputWithContext(context.Context) WorkforceArrayOutput
   266  }
   267  
   268  type WorkforceArray []WorkforceInput
   269  
   270  func (WorkforceArray) ElementType() reflect.Type {
   271  	return reflect.TypeOf((*[]*Workforce)(nil)).Elem()
   272  }
   273  
   274  func (i WorkforceArray) ToWorkforceArrayOutput() WorkforceArrayOutput {
   275  	return i.ToWorkforceArrayOutputWithContext(context.Background())
   276  }
   277  
   278  func (i WorkforceArray) ToWorkforceArrayOutputWithContext(ctx context.Context) WorkforceArrayOutput {
   279  	return pulumi.ToOutputWithContext(ctx, i).(WorkforceArrayOutput)
   280  }
   281  
   282  // WorkforceMapInput is an input type that accepts WorkforceMap and WorkforceMapOutput values.
   283  // You can construct a concrete instance of `WorkforceMapInput` via:
   284  //
   285  //	WorkforceMap{ "key": WorkforceArgs{...} }
   286  type WorkforceMapInput interface {
   287  	pulumi.Input
   288  
   289  	ToWorkforceMapOutput() WorkforceMapOutput
   290  	ToWorkforceMapOutputWithContext(context.Context) WorkforceMapOutput
   291  }
   292  
   293  type WorkforceMap map[string]WorkforceInput
   294  
   295  func (WorkforceMap) ElementType() reflect.Type {
   296  	return reflect.TypeOf((*map[string]*Workforce)(nil)).Elem()
   297  }
   298  
   299  func (i WorkforceMap) ToWorkforceMapOutput() WorkforceMapOutput {
   300  	return i.ToWorkforceMapOutputWithContext(context.Background())
   301  }
   302  
   303  func (i WorkforceMap) ToWorkforceMapOutputWithContext(ctx context.Context) WorkforceMapOutput {
   304  	return pulumi.ToOutputWithContext(ctx, i).(WorkforceMapOutput)
   305  }
   306  
   307  type WorkforceOutput struct{ *pulumi.OutputState }
   308  
   309  func (WorkforceOutput) ElementType() reflect.Type {
   310  	return reflect.TypeOf((**Workforce)(nil)).Elem()
   311  }
   312  
   313  func (o WorkforceOutput) ToWorkforceOutput() WorkforceOutput {
   314  	return o
   315  }
   316  
   317  func (o WorkforceOutput) ToWorkforceOutputWithContext(ctx context.Context) WorkforceOutput {
   318  	return o
   319  }
   320  
   321  // The Amazon Resource Name (ARN) assigned by AWS to this Workforce.
   322  func (o WorkforceOutput) Arn() pulumi.StringOutput {
   323  	return o.ApplyT(func(v *Workforce) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   324  }
   325  
   326  // Use this parameter to configure an Amazon Cognito private workforce. A single Cognito workforce is created using and corresponds to a single Amazon Cognito user pool. Conflicts with `oidcConfig`. see Cognito Config details below.
   327  func (o WorkforceOutput) CognitoConfig() WorkforceCognitoConfigPtrOutput {
   328  	return o.ApplyT(func(v *Workforce) WorkforceCognitoConfigPtrOutput { return v.CognitoConfig }).(WorkforceCognitoConfigPtrOutput)
   329  }
   330  
   331  // Use this parameter to configure a private workforce using your own OIDC Identity Provider. Conflicts with `cognitoConfig`. see OIDC Config details below.
   332  func (o WorkforceOutput) OidcConfig() WorkforceOidcConfigPtrOutput {
   333  	return o.ApplyT(func(v *Workforce) WorkforceOidcConfigPtrOutput { return v.OidcConfig }).(WorkforceOidcConfigPtrOutput)
   334  }
   335  
   336  // A list of IP address ranges Used to create an allow list of IP addresses for a private workforce. By default, a workforce isn't restricted to specific IP addresses. see Source Ip Config details below.
   337  func (o WorkforceOutput) SourceIpConfig() WorkforceSourceIpConfigOutput {
   338  	return o.ApplyT(func(v *Workforce) WorkforceSourceIpConfigOutput { return v.SourceIpConfig }).(WorkforceSourceIpConfigOutput)
   339  }
   340  
   341  // The subdomain for your OIDC Identity Provider.
   342  func (o WorkforceOutput) Subdomain() pulumi.StringOutput {
   343  	return o.ApplyT(func(v *Workforce) pulumi.StringOutput { return v.Subdomain }).(pulumi.StringOutput)
   344  }
   345  
   346  // The name of the Workforce (must be unique).
   347  func (o WorkforceOutput) WorkforceName() pulumi.StringOutput {
   348  	return o.ApplyT(func(v *Workforce) pulumi.StringOutput { return v.WorkforceName }).(pulumi.StringOutput)
   349  }
   350  
   351  // configure a workforce using VPC. see Workforce VPC Config details below.
   352  func (o WorkforceOutput) WorkforceVpcConfig() WorkforceWorkforceVpcConfigPtrOutput {
   353  	return o.ApplyT(func(v *Workforce) WorkforceWorkforceVpcConfigPtrOutput { return v.WorkforceVpcConfig }).(WorkforceWorkforceVpcConfigPtrOutput)
   354  }
   355  
   356  type WorkforceArrayOutput struct{ *pulumi.OutputState }
   357  
   358  func (WorkforceArrayOutput) ElementType() reflect.Type {
   359  	return reflect.TypeOf((*[]*Workforce)(nil)).Elem()
   360  }
   361  
   362  func (o WorkforceArrayOutput) ToWorkforceArrayOutput() WorkforceArrayOutput {
   363  	return o
   364  }
   365  
   366  func (o WorkforceArrayOutput) ToWorkforceArrayOutputWithContext(ctx context.Context) WorkforceArrayOutput {
   367  	return o
   368  }
   369  
   370  func (o WorkforceArrayOutput) Index(i pulumi.IntInput) WorkforceOutput {
   371  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Workforce {
   372  		return vs[0].([]*Workforce)[vs[1].(int)]
   373  	}).(WorkforceOutput)
   374  }
   375  
   376  type WorkforceMapOutput struct{ *pulumi.OutputState }
   377  
   378  func (WorkforceMapOutput) ElementType() reflect.Type {
   379  	return reflect.TypeOf((*map[string]*Workforce)(nil)).Elem()
   380  }
   381  
   382  func (o WorkforceMapOutput) ToWorkforceMapOutput() WorkforceMapOutput {
   383  	return o
   384  }
   385  
   386  func (o WorkforceMapOutput) ToWorkforceMapOutputWithContext(ctx context.Context) WorkforceMapOutput {
   387  	return o
   388  }
   389  
   390  func (o WorkforceMapOutput) MapIndex(k pulumi.StringInput) WorkforceOutput {
   391  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Workforce {
   392  		return vs[0].(map[string]*Workforce)[vs[1].(string)]
   393  	}).(WorkforceOutput)
   394  }
   395  
   396  func init() {
   397  	pulumi.RegisterInputType(reflect.TypeOf((*WorkforceInput)(nil)).Elem(), &Workforce{})
   398  	pulumi.RegisterInputType(reflect.TypeOf((*WorkforceArrayInput)(nil)).Elem(), WorkforceArray{})
   399  	pulumi.RegisterInputType(reflect.TypeOf((*WorkforceMapInput)(nil)).Elem(), WorkforceMap{})
   400  	pulumi.RegisterOutputType(WorkforceOutput{})
   401  	pulumi.RegisterOutputType(WorkforceArrayOutput{})
   402  	pulumi.RegisterOutputType(WorkforceMapOutput{})
   403  }