github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/appconfig/hostedConfigurationVersion.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 appconfig
     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 an AppConfig Hosted Configuration Version resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Freeform
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"encoding/json"
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appconfig"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    37  //				"foo": "bar",
    38  //				"fruit": []string{
    39  //					"apple",
    40  //					"pear",
    41  //					"orange",
    42  //				},
    43  //				"isThingEnabled": true,
    44  //			})
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			json0 := string(tmpJSON0)
    49  //			_, err = appconfig.NewHostedConfigurationVersion(ctx, "example", &appconfig.HostedConfigurationVersionArgs{
    50  //				ApplicationId:          pulumi.Any(exampleAwsAppconfigApplication.Id),
    51  //				ConfigurationProfileId: pulumi.Any(exampleAwsAppconfigConfigurationProfile.ConfigurationProfileId),
    52  //				Description:            pulumi.String("Example Freeform Hosted Configuration Version"),
    53  //				ContentType:            pulumi.String("application/json"),
    54  //				Content:                pulumi.String(json0),
    55  //			})
    56  //			if err != nil {
    57  //				return err
    58  //			}
    59  //			return nil
    60  //		})
    61  //	}
    62  //
    63  // ```
    64  // <!--End PulumiCodeChooser -->
    65  //
    66  // ### Feature Flags
    67  //
    68  // <!--Start PulumiCodeChooser -->
    69  // ```go
    70  // package main
    71  //
    72  // import (
    73  //
    74  //	"encoding/json"
    75  //
    76  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appconfig"
    77  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    78  //
    79  // )
    80  //
    81  //	func main() {
    82  //		pulumi.Run(func(ctx *pulumi.Context) error {
    83  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    84  //				"flags": map[string]interface{}{
    85  //					"foo": map[string]interface{}{
    86  //						"name": "foo",
    87  //						"_deprecation": map[string]interface{}{
    88  //							"status": "planned",
    89  //						},
    90  //					},
    91  //					"bar": map[string]interface{}{
    92  //						"name": "bar",
    93  //						"attributes": map[string]interface{}{
    94  //							"someAttribute": map[string]interface{}{
    95  //								"constraints": map[string]interface{}{
    96  //									"type":     "string",
    97  //									"required": true,
    98  //								},
    99  //							},
   100  //							"someOtherAttribute": map[string]interface{}{
   101  //								"constraints": map[string]interface{}{
   102  //									"type":     "number",
   103  //									"required": true,
   104  //								},
   105  //							},
   106  //						},
   107  //					},
   108  //				},
   109  //				"values": map[string]interface{}{
   110  //					"foo": map[string]interface{}{
   111  //						"enabled": "true",
   112  //					},
   113  //					"bar": map[string]interface{}{
   114  //						"enabled":            "true",
   115  //						"someAttribute":      "Hello World",
   116  //						"someOtherAttribute": 123,
   117  //					},
   118  //				},
   119  //				"version": "1",
   120  //			})
   121  //			if err != nil {
   122  //				return err
   123  //			}
   124  //			json0 := string(tmpJSON0)
   125  //			_, err = appconfig.NewHostedConfigurationVersion(ctx, "example", &appconfig.HostedConfigurationVersionArgs{
   126  //				ApplicationId:          pulumi.Any(exampleAwsAppconfigApplication.Id),
   127  //				ConfigurationProfileId: pulumi.Any(exampleAwsAppconfigConfigurationProfile.ConfigurationProfileId),
   128  //				Description:            pulumi.String("Example Feature Flag Configuration Version"),
   129  //				ContentType:            pulumi.String("application/json"),
   130  //				Content:                pulumi.String(json0),
   131  //			})
   132  //			if err != nil {
   133  //				return err
   134  //			}
   135  //			return nil
   136  //		})
   137  //	}
   138  //
   139  // ```
   140  // <!--End PulumiCodeChooser -->
   141  //
   142  // ## Import
   143  //
   144  // Using `pulumi import`, import AppConfig Hosted Configuration Versions using the application ID, configuration profile ID, and version number separated by a slash (`/`). For example:
   145  //
   146  // ```sh
   147  // $ pulumi import aws:appconfig/hostedConfigurationVersion:HostedConfigurationVersion example 71abcde/11xxxxx/2
   148  // ```
   149  type HostedConfigurationVersion struct {
   150  	pulumi.CustomResourceState
   151  
   152  	// Application ID.
   153  	ApplicationId pulumi.StringOutput `pulumi:"applicationId"`
   154  	// ARN of the AppConfig  hosted configuration version.
   155  	Arn pulumi.StringOutput `pulumi:"arn"`
   156  	// Configuration profile ID.
   157  	ConfigurationProfileId pulumi.StringOutput `pulumi:"configurationProfileId"`
   158  	// Content of the configuration or the configuration data.
   159  	Content pulumi.StringOutput `pulumi:"content"`
   160  	// Standard MIME type describing the format of the configuration content. For more information, see [Content-Type](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17).
   161  	ContentType pulumi.StringOutput `pulumi:"contentType"`
   162  	// Description of the configuration.
   163  	Description pulumi.StringPtrOutput `pulumi:"description"`
   164  	// Version number of the hosted configuration.
   165  	VersionNumber pulumi.IntOutput `pulumi:"versionNumber"`
   166  }
   167  
   168  // NewHostedConfigurationVersion registers a new resource with the given unique name, arguments, and options.
   169  func NewHostedConfigurationVersion(ctx *pulumi.Context,
   170  	name string, args *HostedConfigurationVersionArgs, opts ...pulumi.ResourceOption) (*HostedConfigurationVersion, error) {
   171  	if args == nil {
   172  		return nil, errors.New("missing one or more required arguments")
   173  	}
   174  
   175  	if args.ApplicationId == nil {
   176  		return nil, errors.New("invalid value for required argument 'ApplicationId'")
   177  	}
   178  	if args.ConfigurationProfileId == nil {
   179  		return nil, errors.New("invalid value for required argument 'ConfigurationProfileId'")
   180  	}
   181  	if args.Content == nil {
   182  		return nil, errors.New("invalid value for required argument 'Content'")
   183  	}
   184  	if args.ContentType == nil {
   185  		return nil, errors.New("invalid value for required argument 'ContentType'")
   186  	}
   187  	if args.Content != nil {
   188  		args.Content = pulumi.ToSecret(args.Content).(pulumi.StringInput)
   189  	}
   190  	secrets := pulumi.AdditionalSecretOutputs([]string{
   191  		"content",
   192  	})
   193  	opts = append(opts, secrets)
   194  	opts = internal.PkgResourceDefaultOpts(opts)
   195  	var resource HostedConfigurationVersion
   196  	err := ctx.RegisterResource("aws:appconfig/hostedConfigurationVersion:HostedConfigurationVersion", name, args, &resource, opts...)
   197  	if err != nil {
   198  		return nil, err
   199  	}
   200  	return &resource, nil
   201  }
   202  
   203  // GetHostedConfigurationVersion gets an existing HostedConfigurationVersion resource's state with the given name, ID, and optional
   204  // state properties that are used to uniquely qualify the lookup (nil if not required).
   205  func GetHostedConfigurationVersion(ctx *pulumi.Context,
   206  	name string, id pulumi.IDInput, state *HostedConfigurationVersionState, opts ...pulumi.ResourceOption) (*HostedConfigurationVersion, error) {
   207  	var resource HostedConfigurationVersion
   208  	err := ctx.ReadResource("aws:appconfig/hostedConfigurationVersion:HostedConfigurationVersion", name, id, state, &resource, opts...)
   209  	if err != nil {
   210  		return nil, err
   211  	}
   212  	return &resource, nil
   213  }
   214  
   215  // Input properties used for looking up and filtering HostedConfigurationVersion resources.
   216  type hostedConfigurationVersionState struct {
   217  	// Application ID.
   218  	ApplicationId *string `pulumi:"applicationId"`
   219  	// ARN of the AppConfig  hosted configuration version.
   220  	Arn *string `pulumi:"arn"`
   221  	// Configuration profile ID.
   222  	ConfigurationProfileId *string `pulumi:"configurationProfileId"`
   223  	// Content of the configuration or the configuration data.
   224  	Content *string `pulumi:"content"`
   225  	// Standard MIME type describing the format of the configuration content. For more information, see [Content-Type](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17).
   226  	ContentType *string `pulumi:"contentType"`
   227  	// Description of the configuration.
   228  	Description *string `pulumi:"description"`
   229  	// Version number of the hosted configuration.
   230  	VersionNumber *int `pulumi:"versionNumber"`
   231  }
   232  
   233  type HostedConfigurationVersionState struct {
   234  	// Application ID.
   235  	ApplicationId pulumi.StringPtrInput
   236  	// ARN of the AppConfig  hosted configuration version.
   237  	Arn pulumi.StringPtrInput
   238  	// Configuration profile ID.
   239  	ConfigurationProfileId pulumi.StringPtrInput
   240  	// Content of the configuration or the configuration data.
   241  	Content pulumi.StringPtrInput
   242  	// Standard MIME type describing the format of the configuration content. For more information, see [Content-Type](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17).
   243  	ContentType pulumi.StringPtrInput
   244  	// Description of the configuration.
   245  	Description pulumi.StringPtrInput
   246  	// Version number of the hosted configuration.
   247  	VersionNumber pulumi.IntPtrInput
   248  }
   249  
   250  func (HostedConfigurationVersionState) ElementType() reflect.Type {
   251  	return reflect.TypeOf((*hostedConfigurationVersionState)(nil)).Elem()
   252  }
   253  
   254  type hostedConfigurationVersionArgs struct {
   255  	// Application ID.
   256  	ApplicationId string `pulumi:"applicationId"`
   257  	// Configuration profile ID.
   258  	ConfigurationProfileId string `pulumi:"configurationProfileId"`
   259  	// Content of the configuration or the configuration data.
   260  	Content string `pulumi:"content"`
   261  	// Standard MIME type describing the format of the configuration content. For more information, see [Content-Type](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17).
   262  	ContentType string `pulumi:"contentType"`
   263  	// Description of the configuration.
   264  	Description *string `pulumi:"description"`
   265  }
   266  
   267  // The set of arguments for constructing a HostedConfigurationVersion resource.
   268  type HostedConfigurationVersionArgs struct {
   269  	// Application ID.
   270  	ApplicationId pulumi.StringInput
   271  	// Configuration profile ID.
   272  	ConfigurationProfileId pulumi.StringInput
   273  	// Content of the configuration or the configuration data.
   274  	Content pulumi.StringInput
   275  	// Standard MIME type describing the format of the configuration content. For more information, see [Content-Type](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17).
   276  	ContentType pulumi.StringInput
   277  	// Description of the configuration.
   278  	Description pulumi.StringPtrInput
   279  }
   280  
   281  func (HostedConfigurationVersionArgs) ElementType() reflect.Type {
   282  	return reflect.TypeOf((*hostedConfigurationVersionArgs)(nil)).Elem()
   283  }
   284  
   285  type HostedConfigurationVersionInput interface {
   286  	pulumi.Input
   287  
   288  	ToHostedConfigurationVersionOutput() HostedConfigurationVersionOutput
   289  	ToHostedConfigurationVersionOutputWithContext(ctx context.Context) HostedConfigurationVersionOutput
   290  }
   291  
   292  func (*HostedConfigurationVersion) ElementType() reflect.Type {
   293  	return reflect.TypeOf((**HostedConfigurationVersion)(nil)).Elem()
   294  }
   295  
   296  func (i *HostedConfigurationVersion) ToHostedConfigurationVersionOutput() HostedConfigurationVersionOutput {
   297  	return i.ToHostedConfigurationVersionOutputWithContext(context.Background())
   298  }
   299  
   300  func (i *HostedConfigurationVersion) ToHostedConfigurationVersionOutputWithContext(ctx context.Context) HostedConfigurationVersionOutput {
   301  	return pulumi.ToOutputWithContext(ctx, i).(HostedConfigurationVersionOutput)
   302  }
   303  
   304  // HostedConfigurationVersionArrayInput is an input type that accepts HostedConfigurationVersionArray and HostedConfigurationVersionArrayOutput values.
   305  // You can construct a concrete instance of `HostedConfigurationVersionArrayInput` via:
   306  //
   307  //	HostedConfigurationVersionArray{ HostedConfigurationVersionArgs{...} }
   308  type HostedConfigurationVersionArrayInput interface {
   309  	pulumi.Input
   310  
   311  	ToHostedConfigurationVersionArrayOutput() HostedConfigurationVersionArrayOutput
   312  	ToHostedConfigurationVersionArrayOutputWithContext(context.Context) HostedConfigurationVersionArrayOutput
   313  }
   314  
   315  type HostedConfigurationVersionArray []HostedConfigurationVersionInput
   316  
   317  func (HostedConfigurationVersionArray) ElementType() reflect.Type {
   318  	return reflect.TypeOf((*[]*HostedConfigurationVersion)(nil)).Elem()
   319  }
   320  
   321  func (i HostedConfigurationVersionArray) ToHostedConfigurationVersionArrayOutput() HostedConfigurationVersionArrayOutput {
   322  	return i.ToHostedConfigurationVersionArrayOutputWithContext(context.Background())
   323  }
   324  
   325  func (i HostedConfigurationVersionArray) ToHostedConfigurationVersionArrayOutputWithContext(ctx context.Context) HostedConfigurationVersionArrayOutput {
   326  	return pulumi.ToOutputWithContext(ctx, i).(HostedConfigurationVersionArrayOutput)
   327  }
   328  
   329  // HostedConfigurationVersionMapInput is an input type that accepts HostedConfigurationVersionMap and HostedConfigurationVersionMapOutput values.
   330  // You can construct a concrete instance of `HostedConfigurationVersionMapInput` via:
   331  //
   332  //	HostedConfigurationVersionMap{ "key": HostedConfigurationVersionArgs{...} }
   333  type HostedConfigurationVersionMapInput interface {
   334  	pulumi.Input
   335  
   336  	ToHostedConfigurationVersionMapOutput() HostedConfigurationVersionMapOutput
   337  	ToHostedConfigurationVersionMapOutputWithContext(context.Context) HostedConfigurationVersionMapOutput
   338  }
   339  
   340  type HostedConfigurationVersionMap map[string]HostedConfigurationVersionInput
   341  
   342  func (HostedConfigurationVersionMap) ElementType() reflect.Type {
   343  	return reflect.TypeOf((*map[string]*HostedConfigurationVersion)(nil)).Elem()
   344  }
   345  
   346  func (i HostedConfigurationVersionMap) ToHostedConfigurationVersionMapOutput() HostedConfigurationVersionMapOutput {
   347  	return i.ToHostedConfigurationVersionMapOutputWithContext(context.Background())
   348  }
   349  
   350  func (i HostedConfigurationVersionMap) ToHostedConfigurationVersionMapOutputWithContext(ctx context.Context) HostedConfigurationVersionMapOutput {
   351  	return pulumi.ToOutputWithContext(ctx, i).(HostedConfigurationVersionMapOutput)
   352  }
   353  
   354  type HostedConfigurationVersionOutput struct{ *pulumi.OutputState }
   355  
   356  func (HostedConfigurationVersionOutput) ElementType() reflect.Type {
   357  	return reflect.TypeOf((**HostedConfigurationVersion)(nil)).Elem()
   358  }
   359  
   360  func (o HostedConfigurationVersionOutput) ToHostedConfigurationVersionOutput() HostedConfigurationVersionOutput {
   361  	return o
   362  }
   363  
   364  func (o HostedConfigurationVersionOutput) ToHostedConfigurationVersionOutputWithContext(ctx context.Context) HostedConfigurationVersionOutput {
   365  	return o
   366  }
   367  
   368  // Application ID.
   369  func (o HostedConfigurationVersionOutput) ApplicationId() pulumi.StringOutput {
   370  	return o.ApplyT(func(v *HostedConfigurationVersion) pulumi.StringOutput { return v.ApplicationId }).(pulumi.StringOutput)
   371  }
   372  
   373  // ARN of the AppConfig  hosted configuration version.
   374  func (o HostedConfigurationVersionOutput) Arn() pulumi.StringOutput {
   375  	return o.ApplyT(func(v *HostedConfigurationVersion) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   376  }
   377  
   378  // Configuration profile ID.
   379  func (o HostedConfigurationVersionOutput) ConfigurationProfileId() pulumi.StringOutput {
   380  	return o.ApplyT(func(v *HostedConfigurationVersion) pulumi.StringOutput { return v.ConfigurationProfileId }).(pulumi.StringOutput)
   381  }
   382  
   383  // Content of the configuration or the configuration data.
   384  func (o HostedConfigurationVersionOutput) Content() pulumi.StringOutput {
   385  	return o.ApplyT(func(v *HostedConfigurationVersion) pulumi.StringOutput { return v.Content }).(pulumi.StringOutput)
   386  }
   387  
   388  // Standard MIME type describing the format of the configuration content. For more information, see [Content-Type](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17).
   389  func (o HostedConfigurationVersionOutput) ContentType() pulumi.StringOutput {
   390  	return o.ApplyT(func(v *HostedConfigurationVersion) pulumi.StringOutput { return v.ContentType }).(pulumi.StringOutput)
   391  }
   392  
   393  // Description of the configuration.
   394  func (o HostedConfigurationVersionOutput) Description() pulumi.StringPtrOutput {
   395  	return o.ApplyT(func(v *HostedConfigurationVersion) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   396  }
   397  
   398  // Version number of the hosted configuration.
   399  func (o HostedConfigurationVersionOutput) VersionNumber() pulumi.IntOutput {
   400  	return o.ApplyT(func(v *HostedConfigurationVersion) pulumi.IntOutput { return v.VersionNumber }).(pulumi.IntOutput)
   401  }
   402  
   403  type HostedConfigurationVersionArrayOutput struct{ *pulumi.OutputState }
   404  
   405  func (HostedConfigurationVersionArrayOutput) ElementType() reflect.Type {
   406  	return reflect.TypeOf((*[]*HostedConfigurationVersion)(nil)).Elem()
   407  }
   408  
   409  func (o HostedConfigurationVersionArrayOutput) ToHostedConfigurationVersionArrayOutput() HostedConfigurationVersionArrayOutput {
   410  	return o
   411  }
   412  
   413  func (o HostedConfigurationVersionArrayOutput) ToHostedConfigurationVersionArrayOutputWithContext(ctx context.Context) HostedConfigurationVersionArrayOutput {
   414  	return o
   415  }
   416  
   417  func (o HostedConfigurationVersionArrayOutput) Index(i pulumi.IntInput) HostedConfigurationVersionOutput {
   418  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *HostedConfigurationVersion {
   419  		return vs[0].([]*HostedConfigurationVersion)[vs[1].(int)]
   420  	}).(HostedConfigurationVersionOutput)
   421  }
   422  
   423  type HostedConfigurationVersionMapOutput struct{ *pulumi.OutputState }
   424  
   425  func (HostedConfigurationVersionMapOutput) ElementType() reflect.Type {
   426  	return reflect.TypeOf((*map[string]*HostedConfigurationVersion)(nil)).Elem()
   427  }
   428  
   429  func (o HostedConfigurationVersionMapOutput) ToHostedConfigurationVersionMapOutput() HostedConfigurationVersionMapOutput {
   430  	return o
   431  }
   432  
   433  func (o HostedConfigurationVersionMapOutput) ToHostedConfigurationVersionMapOutputWithContext(ctx context.Context) HostedConfigurationVersionMapOutput {
   434  	return o
   435  }
   436  
   437  func (o HostedConfigurationVersionMapOutput) MapIndex(k pulumi.StringInput) HostedConfigurationVersionOutput {
   438  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *HostedConfigurationVersion {
   439  		return vs[0].(map[string]*HostedConfigurationVersion)[vs[1].(string)]
   440  	}).(HostedConfigurationVersionOutput)
   441  }
   442  
   443  func init() {
   444  	pulumi.RegisterInputType(reflect.TypeOf((*HostedConfigurationVersionInput)(nil)).Elem(), &HostedConfigurationVersion{})
   445  	pulumi.RegisterInputType(reflect.TypeOf((*HostedConfigurationVersionArrayInput)(nil)).Elem(), HostedConfigurationVersionArray{})
   446  	pulumi.RegisterInputType(reflect.TypeOf((*HostedConfigurationVersionMapInput)(nil)).Elem(), HostedConfigurationVersionMap{})
   447  	pulumi.RegisterOutputType(HostedConfigurationVersionOutput{})
   448  	pulumi.RegisterOutputType(HostedConfigurationVersionArrayOutput{})
   449  	pulumi.RegisterOutputType(HostedConfigurationVersionMapOutput{})
   450  }