github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/servicecatalog/serviceAction.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 servicecatalog
     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  // Manages a Service Catalog self-service action.
    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/servicecatalog"
    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 := servicecatalog.NewServiceAction(ctx, "example", &servicecatalog.ServiceActionArgs{
    35  //				Description: pulumi.String("Motor generator unit"),
    36  //				Name:        pulumi.String("MGU"),
    37  //				Definition: &servicecatalog.ServiceActionDefinitionArgs{
    38  //					Name: pulumi.String("AWS-RestartEC2Instance"),
    39  //				},
    40  //			})
    41  //			if err != nil {
    42  //				return err
    43  //			}
    44  //			return nil
    45  //		})
    46  //	}
    47  //
    48  // ```
    49  // <!--End PulumiCodeChooser -->
    50  //
    51  // ## Import
    52  //
    53  // Using `pulumi import`, import `aws_servicecatalog_service_action` using the service action ID. For example:
    54  //
    55  // ```sh
    56  // $ pulumi import aws:servicecatalog/serviceAction:ServiceAction example act-f1w12eperfslh
    57  // ```
    58  type ServiceAction struct {
    59  	pulumi.CustomResourceState
    60  
    61  	// Language code. Valid values are `en` (English), `jp` (Japanese), and `zh` (Chinese). Default is `en`.
    62  	AcceptLanguage pulumi.StringPtrOutput `pulumi:"acceptLanguage"`
    63  	// Self-service action definition configuration block. Detailed below.
    64  	Definition ServiceActionDefinitionOutput `pulumi:"definition"`
    65  	// Self-service action description.
    66  	Description pulumi.StringOutput `pulumi:"description"`
    67  	// Self-service action name.
    68  	//
    69  	// The following arguments are optional:
    70  	Name pulumi.StringOutput `pulumi:"name"`
    71  }
    72  
    73  // NewServiceAction registers a new resource with the given unique name, arguments, and options.
    74  func NewServiceAction(ctx *pulumi.Context,
    75  	name string, args *ServiceActionArgs, opts ...pulumi.ResourceOption) (*ServiceAction, error) {
    76  	if args == nil {
    77  		return nil, errors.New("missing one or more required arguments")
    78  	}
    79  
    80  	if args.Definition == nil {
    81  		return nil, errors.New("invalid value for required argument 'Definition'")
    82  	}
    83  	opts = internal.PkgResourceDefaultOpts(opts)
    84  	var resource ServiceAction
    85  	err := ctx.RegisterResource("aws:servicecatalog/serviceAction:ServiceAction", name, args, &resource, opts...)
    86  	if err != nil {
    87  		return nil, err
    88  	}
    89  	return &resource, nil
    90  }
    91  
    92  // GetServiceAction gets an existing ServiceAction resource's state with the given name, ID, and optional
    93  // state properties that are used to uniquely qualify the lookup (nil if not required).
    94  func GetServiceAction(ctx *pulumi.Context,
    95  	name string, id pulumi.IDInput, state *ServiceActionState, opts ...pulumi.ResourceOption) (*ServiceAction, error) {
    96  	var resource ServiceAction
    97  	err := ctx.ReadResource("aws:servicecatalog/serviceAction:ServiceAction", name, id, state, &resource, opts...)
    98  	if err != nil {
    99  		return nil, err
   100  	}
   101  	return &resource, nil
   102  }
   103  
   104  // Input properties used for looking up and filtering ServiceAction resources.
   105  type serviceActionState struct {
   106  	// Language code. Valid values are `en` (English), `jp` (Japanese), and `zh` (Chinese). Default is `en`.
   107  	AcceptLanguage *string `pulumi:"acceptLanguage"`
   108  	// Self-service action definition configuration block. Detailed below.
   109  	Definition *ServiceActionDefinition `pulumi:"definition"`
   110  	// Self-service action description.
   111  	Description *string `pulumi:"description"`
   112  	// Self-service action name.
   113  	//
   114  	// The following arguments are optional:
   115  	Name *string `pulumi:"name"`
   116  }
   117  
   118  type ServiceActionState struct {
   119  	// Language code. Valid values are `en` (English), `jp` (Japanese), and `zh` (Chinese). Default is `en`.
   120  	AcceptLanguage pulumi.StringPtrInput
   121  	// Self-service action definition configuration block. Detailed below.
   122  	Definition ServiceActionDefinitionPtrInput
   123  	// Self-service action description.
   124  	Description pulumi.StringPtrInput
   125  	// Self-service action name.
   126  	//
   127  	// The following arguments are optional:
   128  	Name pulumi.StringPtrInput
   129  }
   130  
   131  func (ServiceActionState) ElementType() reflect.Type {
   132  	return reflect.TypeOf((*serviceActionState)(nil)).Elem()
   133  }
   134  
   135  type serviceActionArgs struct {
   136  	// Language code. Valid values are `en` (English), `jp` (Japanese), and `zh` (Chinese). Default is `en`.
   137  	AcceptLanguage *string `pulumi:"acceptLanguage"`
   138  	// Self-service action definition configuration block. Detailed below.
   139  	Definition ServiceActionDefinition `pulumi:"definition"`
   140  	// Self-service action description.
   141  	Description *string `pulumi:"description"`
   142  	// Self-service action name.
   143  	//
   144  	// The following arguments are optional:
   145  	Name *string `pulumi:"name"`
   146  }
   147  
   148  // The set of arguments for constructing a ServiceAction resource.
   149  type ServiceActionArgs struct {
   150  	// Language code. Valid values are `en` (English), `jp` (Japanese), and `zh` (Chinese). Default is `en`.
   151  	AcceptLanguage pulumi.StringPtrInput
   152  	// Self-service action definition configuration block. Detailed below.
   153  	Definition ServiceActionDefinitionInput
   154  	// Self-service action description.
   155  	Description pulumi.StringPtrInput
   156  	// Self-service action name.
   157  	//
   158  	// The following arguments are optional:
   159  	Name pulumi.StringPtrInput
   160  }
   161  
   162  func (ServiceActionArgs) ElementType() reflect.Type {
   163  	return reflect.TypeOf((*serviceActionArgs)(nil)).Elem()
   164  }
   165  
   166  type ServiceActionInput interface {
   167  	pulumi.Input
   168  
   169  	ToServiceActionOutput() ServiceActionOutput
   170  	ToServiceActionOutputWithContext(ctx context.Context) ServiceActionOutput
   171  }
   172  
   173  func (*ServiceAction) ElementType() reflect.Type {
   174  	return reflect.TypeOf((**ServiceAction)(nil)).Elem()
   175  }
   176  
   177  func (i *ServiceAction) ToServiceActionOutput() ServiceActionOutput {
   178  	return i.ToServiceActionOutputWithContext(context.Background())
   179  }
   180  
   181  func (i *ServiceAction) ToServiceActionOutputWithContext(ctx context.Context) ServiceActionOutput {
   182  	return pulumi.ToOutputWithContext(ctx, i).(ServiceActionOutput)
   183  }
   184  
   185  // ServiceActionArrayInput is an input type that accepts ServiceActionArray and ServiceActionArrayOutput values.
   186  // You can construct a concrete instance of `ServiceActionArrayInput` via:
   187  //
   188  //	ServiceActionArray{ ServiceActionArgs{...} }
   189  type ServiceActionArrayInput interface {
   190  	pulumi.Input
   191  
   192  	ToServiceActionArrayOutput() ServiceActionArrayOutput
   193  	ToServiceActionArrayOutputWithContext(context.Context) ServiceActionArrayOutput
   194  }
   195  
   196  type ServiceActionArray []ServiceActionInput
   197  
   198  func (ServiceActionArray) ElementType() reflect.Type {
   199  	return reflect.TypeOf((*[]*ServiceAction)(nil)).Elem()
   200  }
   201  
   202  func (i ServiceActionArray) ToServiceActionArrayOutput() ServiceActionArrayOutput {
   203  	return i.ToServiceActionArrayOutputWithContext(context.Background())
   204  }
   205  
   206  func (i ServiceActionArray) ToServiceActionArrayOutputWithContext(ctx context.Context) ServiceActionArrayOutput {
   207  	return pulumi.ToOutputWithContext(ctx, i).(ServiceActionArrayOutput)
   208  }
   209  
   210  // ServiceActionMapInput is an input type that accepts ServiceActionMap and ServiceActionMapOutput values.
   211  // You can construct a concrete instance of `ServiceActionMapInput` via:
   212  //
   213  //	ServiceActionMap{ "key": ServiceActionArgs{...} }
   214  type ServiceActionMapInput interface {
   215  	pulumi.Input
   216  
   217  	ToServiceActionMapOutput() ServiceActionMapOutput
   218  	ToServiceActionMapOutputWithContext(context.Context) ServiceActionMapOutput
   219  }
   220  
   221  type ServiceActionMap map[string]ServiceActionInput
   222  
   223  func (ServiceActionMap) ElementType() reflect.Type {
   224  	return reflect.TypeOf((*map[string]*ServiceAction)(nil)).Elem()
   225  }
   226  
   227  func (i ServiceActionMap) ToServiceActionMapOutput() ServiceActionMapOutput {
   228  	return i.ToServiceActionMapOutputWithContext(context.Background())
   229  }
   230  
   231  func (i ServiceActionMap) ToServiceActionMapOutputWithContext(ctx context.Context) ServiceActionMapOutput {
   232  	return pulumi.ToOutputWithContext(ctx, i).(ServiceActionMapOutput)
   233  }
   234  
   235  type ServiceActionOutput struct{ *pulumi.OutputState }
   236  
   237  func (ServiceActionOutput) ElementType() reflect.Type {
   238  	return reflect.TypeOf((**ServiceAction)(nil)).Elem()
   239  }
   240  
   241  func (o ServiceActionOutput) ToServiceActionOutput() ServiceActionOutput {
   242  	return o
   243  }
   244  
   245  func (o ServiceActionOutput) ToServiceActionOutputWithContext(ctx context.Context) ServiceActionOutput {
   246  	return o
   247  }
   248  
   249  // Language code. Valid values are `en` (English), `jp` (Japanese), and `zh` (Chinese). Default is `en`.
   250  func (o ServiceActionOutput) AcceptLanguage() pulumi.StringPtrOutput {
   251  	return o.ApplyT(func(v *ServiceAction) pulumi.StringPtrOutput { return v.AcceptLanguage }).(pulumi.StringPtrOutput)
   252  }
   253  
   254  // Self-service action definition configuration block. Detailed below.
   255  func (o ServiceActionOutput) Definition() ServiceActionDefinitionOutput {
   256  	return o.ApplyT(func(v *ServiceAction) ServiceActionDefinitionOutput { return v.Definition }).(ServiceActionDefinitionOutput)
   257  }
   258  
   259  // Self-service action description.
   260  func (o ServiceActionOutput) Description() pulumi.StringOutput {
   261  	return o.ApplyT(func(v *ServiceAction) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
   262  }
   263  
   264  // Self-service action name.
   265  //
   266  // The following arguments are optional:
   267  func (o ServiceActionOutput) Name() pulumi.StringOutput {
   268  	return o.ApplyT(func(v *ServiceAction) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   269  }
   270  
   271  type ServiceActionArrayOutput struct{ *pulumi.OutputState }
   272  
   273  func (ServiceActionArrayOutput) ElementType() reflect.Type {
   274  	return reflect.TypeOf((*[]*ServiceAction)(nil)).Elem()
   275  }
   276  
   277  func (o ServiceActionArrayOutput) ToServiceActionArrayOutput() ServiceActionArrayOutput {
   278  	return o
   279  }
   280  
   281  func (o ServiceActionArrayOutput) ToServiceActionArrayOutputWithContext(ctx context.Context) ServiceActionArrayOutput {
   282  	return o
   283  }
   284  
   285  func (o ServiceActionArrayOutput) Index(i pulumi.IntInput) ServiceActionOutput {
   286  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ServiceAction {
   287  		return vs[0].([]*ServiceAction)[vs[1].(int)]
   288  	}).(ServiceActionOutput)
   289  }
   290  
   291  type ServiceActionMapOutput struct{ *pulumi.OutputState }
   292  
   293  func (ServiceActionMapOutput) ElementType() reflect.Type {
   294  	return reflect.TypeOf((*map[string]*ServiceAction)(nil)).Elem()
   295  }
   296  
   297  func (o ServiceActionMapOutput) ToServiceActionMapOutput() ServiceActionMapOutput {
   298  	return o
   299  }
   300  
   301  func (o ServiceActionMapOutput) ToServiceActionMapOutputWithContext(ctx context.Context) ServiceActionMapOutput {
   302  	return o
   303  }
   304  
   305  func (o ServiceActionMapOutput) MapIndex(k pulumi.StringInput) ServiceActionOutput {
   306  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ServiceAction {
   307  		return vs[0].(map[string]*ServiceAction)[vs[1].(string)]
   308  	}).(ServiceActionOutput)
   309  }
   310  
   311  func init() {
   312  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceActionInput)(nil)).Elem(), &ServiceAction{})
   313  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceActionArrayInput)(nil)).Elem(), ServiceActionArray{})
   314  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceActionMapInput)(nil)).Elem(), ServiceActionMap{})
   315  	pulumi.RegisterOutputType(ServiceActionOutput{})
   316  	pulumi.RegisterOutputType(ServiceActionArrayOutput{})
   317  	pulumi.RegisterOutputType(ServiceActionMapOutput{})
   318  }