github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudcontrol/resource.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 cloudcontrol
     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 Cloud Control API Resource. The configuration and lifecycle handling of these resources is proxied through Cloud Control API handlers to the backend service.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"encoding/json"
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudcontrol"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    35  //				"ClusterName": "example",
    36  //				"Tags": []map[string]interface{}{
    37  //					map[string]interface{}{
    38  //						"Key":   "CostCenter",
    39  //						"Value": "IT",
    40  //					},
    41  //				},
    42  //			})
    43  //			if err != nil {
    44  //				return err
    45  //			}
    46  //			json0 := string(tmpJSON0)
    47  //			_, err = cloudcontrol.NewResource(ctx, "example", &cloudcontrol.ResourceArgs{
    48  //				TypeName:     pulumi.String("AWS::ECS::Cluster"),
    49  //				DesiredState: pulumi.String(json0),
    50  //			})
    51  //			if err != nil {
    52  //				return err
    53  //			}
    54  //			return nil
    55  //		})
    56  //	}
    57  //
    58  // ```
    59  // <!--End PulumiCodeChooser -->
    60  type Resource struct {
    61  	pulumi.CustomResourceState
    62  
    63  	// JSON string matching the CloudFormation resource type schema with desired configuration.
    64  	DesiredState pulumi.StringOutput `pulumi:"desiredState"`
    65  	// JSON string matching the CloudFormation resource type schema with current configuration. Underlying attributes can be referenced via the `jsondecode()` function, for example, `jsondecode(data.aws_cloudcontrolapi_resource.example.properties)["example"]`.
    66  	Properties pulumi.StringOutput `pulumi:"properties"`
    67  	// Amazon Resource Name (ARN) of the IAM Role to assume for operations.
    68  	RoleArn pulumi.StringPtrOutput `pulumi:"roleArn"`
    69  	// JSON string of the CloudFormation resource type schema which is used for plan time validation where possible. Automatically fetched if not provided. In large scale environments with multiple resources using the same `typeName`, it is recommended to fetch the schema once via the `cloudformation.CloudFormationType` data source and use this argument to reduce `DescribeType` API operation throttling. This value is marked sensitive only to prevent large plan differences from showing.
    70  	Schema pulumi.StringOutput `pulumi:"schema"`
    71  	// CloudFormation resource type name. For example, `AWS::EC2::VPC`.
    72  	//
    73  	// The following arguments are optional:
    74  	TypeName pulumi.StringOutput `pulumi:"typeName"`
    75  	// Identifier of the CloudFormation resource type version.
    76  	TypeVersionId pulumi.StringPtrOutput `pulumi:"typeVersionId"`
    77  }
    78  
    79  // NewResource registers a new resource with the given unique name, arguments, and options.
    80  func NewResource(ctx *pulumi.Context,
    81  	name string, args *ResourceArgs, opts ...pulumi.ResourceOption) (*Resource, error) {
    82  	if args == nil {
    83  		return nil, errors.New("missing one or more required arguments")
    84  	}
    85  
    86  	if args.DesiredState == nil {
    87  		return nil, errors.New("invalid value for required argument 'DesiredState'")
    88  	}
    89  	if args.TypeName == nil {
    90  		return nil, errors.New("invalid value for required argument 'TypeName'")
    91  	}
    92  	if args.Schema != nil {
    93  		args.Schema = pulumi.ToSecret(args.Schema).(pulumi.StringPtrInput)
    94  	}
    95  	secrets := pulumi.AdditionalSecretOutputs([]string{
    96  		"schema",
    97  	})
    98  	opts = append(opts, secrets)
    99  	opts = internal.PkgResourceDefaultOpts(opts)
   100  	var resource Resource
   101  	err := ctx.RegisterResource("aws:cloudcontrol/resource:Resource", name, args, &resource, opts...)
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  	return &resource, nil
   106  }
   107  
   108  // GetResource gets an existing Resource resource's state with the given name, ID, and optional
   109  // state properties that are used to uniquely qualify the lookup (nil if not required).
   110  func GetResource(ctx *pulumi.Context,
   111  	name string, id pulumi.IDInput, state *ResourceState, opts ...pulumi.ResourceOption) (*Resource, error) {
   112  	var resource Resource
   113  	err := ctx.ReadResource("aws:cloudcontrol/resource:Resource", name, id, state, &resource, opts...)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	return &resource, nil
   118  }
   119  
   120  // Input properties used for looking up and filtering Resource resources.
   121  type resourceState struct {
   122  	// JSON string matching the CloudFormation resource type schema with desired configuration.
   123  	DesiredState *string `pulumi:"desiredState"`
   124  	// JSON string matching the CloudFormation resource type schema with current configuration. Underlying attributes can be referenced via the `jsondecode()` function, for example, `jsondecode(data.aws_cloudcontrolapi_resource.example.properties)["example"]`.
   125  	Properties *string `pulumi:"properties"`
   126  	// Amazon Resource Name (ARN) of the IAM Role to assume for operations.
   127  	RoleArn *string `pulumi:"roleArn"`
   128  	// JSON string of the CloudFormation resource type schema which is used for plan time validation where possible. Automatically fetched if not provided. In large scale environments with multiple resources using the same `typeName`, it is recommended to fetch the schema once via the `cloudformation.CloudFormationType` data source and use this argument to reduce `DescribeType` API operation throttling. This value is marked sensitive only to prevent large plan differences from showing.
   129  	Schema *string `pulumi:"schema"`
   130  	// CloudFormation resource type name. For example, `AWS::EC2::VPC`.
   131  	//
   132  	// The following arguments are optional:
   133  	TypeName *string `pulumi:"typeName"`
   134  	// Identifier of the CloudFormation resource type version.
   135  	TypeVersionId *string `pulumi:"typeVersionId"`
   136  }
   137  
   138  type ResourceState struct {
   139  	// JSON string matching the CloudFormation resource type schema with desired configuration.
   140  	DesiredState pulumi.StringPtrInput
   141  	// JSON string matching the CloudFormation resource type schema with current configuration. Underlying attributes can be referenced via the `jsondecode()` function, for example, `jsondecode(data.aws_cloudcontrolapi_resource.example.properties)["example"]`.
   142  	Properties pulumi.StringPtrInput
   143  	// Amazon Resource Name (ARN) of the IAM Role to assume for operations.
   144  	RoleArn pulumi.StringPtrInput
   145  	// JSON string of the CloudFormation resource type schema which is used for plan time validation where possible. Automatically fetched if not provided. In large scale environments with multiple resources using the same `typeName`, it is recommended to fetch the schema once via the `cloudformation.CloudFormationType` data source and use this argument to reduce `DescribeType` API operation throttling. This value is marked sensitive only to prevent large plan differences from showing.
   146  	Schema pulumi.StringPtrInput
   147  	// CloudFormation resource type name. For example, `AWS::EC2::VPC`.
   148  	//
   149  	// The following arguments are optional:
   150  	TypeName pulumi.StringPtrInput
   151  	// Identifier of the CloudFormation resource type version.
   152  	TypeVersionId pulumi.StringPtrInput
   153  }
   154  
   155  func (ResourceState) ElementType() reflect.Type {
   156  	return reflect.TypeOf((*resourceState)(nil)).Elem()
   157  }
   158  
   159  type resourceArgs struct {
   160  	// JSON string matching the CloudFormation resource type schema with desired configuration.
   161  	DesiredState string `pulumi:"desiredState"`
   162  	// Amazon Resource Name (ARN) of the IAM Role to assume for operations.
   163  	RoleArn *string `pulumi:"roleArn"`
   164  	// JSON string of the CloudFormation resource type schema which is used for plan time validation where possible. Automatically fetched if not provided. In large scale environments with multiple resources using the same `typeName`, it is recommended to fetch the schema once via the `cloudformation.CloudFormationType` data source and use this argument to reduce `DescribeType` API operation throttling. This value is marked sensitive only to prevent large plan differences from showing.
   165  	Schema *string `pulumi:"schema"`
   166  	// CloudFormation resource type name. For example, `AWS::EC2::VPC`.
   167  	//
   168  	// The following arguments are optional:
   169  	TypeName string `pulumi:"typeName"`
   170  	// Identifier of the CloudFormation resource type version.
   171  	TypeVersionId *string `pulumi:"typeVersionId"`
   172  }
   173  
   174  // The set of arguments for constructing a Resource resource.
   175  type ResourceArgs struct {
   176  	// JSON string matching the CloudFormation resource type schema with desired configuration.
   177  	DesiredState pulumi.StringInput
   178  	// Amazon Resource Name (ARN) of the IAM Role to assume for operations.
   179  	RoleArn pulumi.StringPtrInput
   180  	// JSON string of the CloudFormation resource type schema which is used for plan time validation where possible. Automatically fetched if not provided. In large scale environments with multiple resources using the same `typeName`, it is recommended to fetch the schema once via the `cloudformation.CloudFormationType` data source and use this argument to reduce `DescribeType` API operation throttling. This value is marked sensitive only to prevent large plan differences from showing.
   181  	Schema pulumi.StringPtrInput
   182  	// CloudFormation resource type name. For example, `AWS::EC2::VPC`.
   183  	//
   184  	// The following arguments are optional:
   185  	TypeName pulumi.StringInput
   186  	// Identifier of the CloudFormation resource type version.
   187  	TypeVersionId pulumi.StringPtrInput
   188  }
   189  
   190  func (ResourceArgs) ElementType() reflect.Type {
   191  	return reflect.TypeOf((*resourceArgs)(nil)).Elem()
   192  }
   193  
   194  type ResourceInput interface {
   195  	pulumi.Input
   196  
   197  	ToResourceOutput() ResourceOutput
   198  	ToResourceOutputWithContext(ctx context.Context) ResourceOutput
   199  }
   200  
   201  func (*Resource) ElementType() reflect.Type {
   202  	return reflect.TypeOf((**Resource)(nil)).Elem()
   203  }
   204  
   205  func (i *Resource) ToResourceOutput() ResourceOutput {
   206  	return i.ToResourceOutputWithContext(context.Background())
   207  }
   208  
   209  func (i *Resource) ToResourceOutputWithContext(ctx context.Context) ResourceOutput {
   210  	return pulumi.ToOutputWithContext(ctx, i).(ResourceOutput)
   211  }
   212  
   213  // ResourceArrayInput is an input type that accepts ResourceArray and ResourceArrayOutput values.
   214  // You can construct a concrete instance of `ResourceArrayInput` via:
   215  //
   216  //	ResourceArray{ ResourceArgs{...} }
   217  type ResourceArrayInput interface {
   218  	pulumi.Input
   219  
   220  	ToResourceArrayOutput() ResourceArrayOutput
   221  	ToResourceArrayOutputWithContext(context.Context) ResourceArrayOutput
   222  }
   223  
   224  type ResourceArray []ResourceInput
   225  
   226  func (ResourceArray) ElementType() reflect.Type {
   227  	return reflect.TypeOf((*[]*Resource)(nil)).Elem()
   228  }
   229  
   230  func (i ResourceArray) ToResourceArrayOutput() ResourceArrayOutput {
   231  	return i.ToResourceArrayOutputWithContext(context.Background())
   232  }
   233  
   234  func (i ResourceArray) ToResourceArrayOutputWithContext(ctx context.Context) ResourceArrayOutput {
   235  	return pulumi.ToOutputWithContext(ctx, i).(ResourceArrayOutput)
   236  }
   237  
   238  // ResourceMapInput is an input type that accepts ResourceMap and ResourceMapOutput values.
   239  // You can construct a concrete instance of `ResourceMapInput` via:
   240  //
   241  //	ResourceMap{ "key": ResourceArgs{...} }
   242  type ResourceMapInput interface {
   243  	pulumi.Input
   244  
   245  	ToResourceMapOutput() ResourceMapOutput
   246  	ToResourceMapOutputWithContext(context.Context) ResourceMapOutput
   247  }
   248  
   249  type ResourceMap map[string]ResourceInput
   250  
   251  func (ResourceMap) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*map[string]*Resource)(nil)).Elem()
   253  }
   254  
   255  func (i ResourceMap) ToResourceMapOutput() ResourceMapOutput {
   256  	return i.ToResourceMapOutputWithContext(context.Background())
   257  }
   258  
   259  func (i ResourceMap) ToResourceMapOutputWithContext(ctx context.Context) ResourceMapOutput {
   260  	return pulumi.ToOutputWithContext(ctx, i).(ResourceMapOutput)
   261  }
   262  
   263  type ResourceOutput struct{ *pulumi.OutputState }
   264  
   265  func (ResourceOutput) ElementType() reflect.Type {
   266  	return reflect.TypeOf((**Resource)(nil)).Elem()
   267  }
   268  
   269  func (o ResourceOutput) ToResourceOutput() ResourceOutput {
   270  	return o
   271  }
   272  
   273  func (o ResourceOutput) ToResourceOutputWithContext(ctx context.Context) ResourceOutput {
   274  	return o
   275  }
   276  
   277  // JSON string matching the CloudFormation resource type schema with desired configuration.
   278  func (o ResourceOutput) DesiredState() pulumi.StringOutput {
   279  	return o.ApplyT(func(v *Resource) pulumi.StringOutput { return v.DesiredState }).(pulumi.StringOutput)
   280  }
   281  
   282  // JSON string matching the CloudFormation resource type schema with current configuration. Underlying attributes can be referenced via the `jsondecode()` function, for example, `jsondecode(data.aws_cloudcontrolapi_resource.example.properties)["example"]`.
   283  func (o ResourceOutput) Properties() pulumi.StringOutput {
   284  	return o.ApplyT(func(v *Resource) pulumi.StringOutput { return v.Properties }).(pulumi.StringOutput)
   285  }
   286  
   287  // Amazon Resource Name (ARN) of the IAM Role to assume for operations.
   288  func (o ResourceOutput) RoleArn() pulumi.StringPtrOutput {
   289  	return o.ApplyT(func(v *Resource) pulumi.StringPtrOutput { return v.RoleArn }).(pulumi.StringPtrOutput)
   290  }
   291  
   292  // JSON string of the CloudFormation resource type schema which is used for plan time validation where possible. Automatically fetched if not provided. In large scale environments with multiple resources using the same `typeName`, it is recommended to fetch the schema once via the `cloudformation.CloudFormationType` data source and use this argument to reduce `DescribeType` API operation throttling. This value is marked sensitive only to prevent large plan differences from showing.
   293  func (o ResourceOutput) Schema() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *Resource) pulumi.StringOutput { return v.Schema }).(pulumi.StringOutput)
   295  }
   296  
   297  // CloudFormation resource type name. For example, `AWS::EC2::VPC`.
   298  //
   299  // The following arguments are optional:
   300  func (o ResourceOutput) TypeName() pulumi.StringOutput {
   301  	return o.ApplyT(func(v *Resource) pulumi.StringOutput { return v.TypeName }).(pulumi.StringOutput)
   302  }
   303  
   304  // Identifier of the CloudFormation resource type version.
   305  func (o ResourceOutput) TypeVersionId() pulumi.StringPtrOutput {
   306  	return o.ApplyT(func(v *Resource) pulumi.StringPtrOutput { return v.TypeVersionId }).(pulumi.StringPtrOutput)
   307  }
   308  
   309  type ResourceArrayOutput struct{ *pulumi.OutputState }
   310  
   311  func (ResourceArrayOutput) ElementType() reflect.Type {
   312  	return reflect.TypeOf((*[]*Resource)(nil)).Elem()
   313  }
   314  
   315  func (o ResourceArrayOutput) ToResourceArrayOutput() ResourceArrayOutput {
   316  	return o
   317  }
   318  
   319  func (o ResourceArrayOutput) ToResourceArrayOutputWithContext(ctx context.Context) ResourceArrayOutput {
   320  	return o
   321  }
   322  
   323  func (o ResourceArrayOutput) Index(i pulumi.IntInput) ResourceOutput {
   324  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Resource {
   325  		return vs[0].([]*Resource)[vs[1].(int)]
   326  	}).(ResourceOutput)
   327  }
   328  
   329  type ResourceMapOutput struct{ *pulumi.OutputState }
   330  
   331  func (ResourceMapOutput) ElementType() reflect.Type {
   332  	return reflect.TypeOf((*map[string]*Resource)(nil)).Elem()
   333  }
   334  
   335  func (o ResourceMapOutput) ToResourceMapOutput() ResourceMapOutput {
   336  	return o
   337  }
   338  
   339  func (o ResourceMapOutput) ToResourceMapOutputWithContext(ctx context.Context) ResourceMapOutput {
   340  	return o
   341  }
   342  
   343  func (o ResourceMapOutput) MapIndex(k pulumi.StringInput) ResourceOutput {
   344  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Resource {
   345  		return vs[0].(map[string]*Resource)[vs[1].(string)]
   346  	}).(ResourceOutput)
   347  }
   348  
   349  func init() {
   350  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceInput)(nil)).Elem(), &Resource{})
   351  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceArrayInput)(nil)).Elem(), ResourceArray{})
   352  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceMapInput)(nil)).Elem(), ResourceMap{})
   353  	pulumi.RegisterOutputType(ResourceOutput{})
   354  	pulumi.RegisterOutputType(ResourceArrayOutput{})
   355  	pulumi.RegisterOutputType(ResourceMapOutput{})
   356  }