github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apigatewayv2/deployment.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 apigatewayv2
     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 an Amazon API Gateway Version 2 deployment.
    16  // More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).
    17  //
    18  // > **Note:** Creating a deployment for an API requires at least one `apigatewayv2.Route` resource associated with that API. To avoid race conditions when all resources are being created together, you need to add implicit resource references via the `triggers` argument or explicit resource references using the [resource `dependsOn` meta-argument](https://www.pulumi.com/docs/intro/concepts/programming-model/#dependson).
    19  //
    20  // ## Example Usage
    21  //
    22  // ## Import
    23  //
    24  // Using `pulumi import`, import `aws_apigatewayv2_deployment` using the API identifier and deployment identifier. For example:
    25  //
    26  // ```sh
    27  // $ pulumi import aws:apigatewayv2/deployment:Deployment example aabbccddee/1122334
    28  // ```
    29  // The `triggers` argument cannot be imported.
    30  type Deployment struct {
    31  	pulumi.CustomResourceState
    32  
    33  	// API identifier.
    34  	ApiId pulumi.StringOutput `pulumi:"apiId"`
    35  	// Whether the deployment was automatically released.
    36  	AutoDeployed pulumi.BoolOutput `pulumi:"autoDeployed"`
    37  	// Description for the deployment resource. Must be less than or equal to 1024 characters in length.
    38  	Description pulumi.StringPtrOutput `pulumi:"description"`
    39  	// Map of arbitrary keys and values that, when changed, will trigger a redeployment.
    40  	Triggers pulumi.StringMapOutput `pulumi:"triggers"`
    41  }
    42  
    43  // NewDeployment registers a new resource with the given unique name, arguments, and options.
    44  func NewDeployment(ctx *pulumi.Context,
    45  	name string, args *DeploymentArgs, opts ...pulumi.ResourceOption) (*Deployment, error) {
    46  	if args == nil {
    47  		return nil, errors.New("missing one or more required arguments")
    48  	}
    49  
    50  	if args.ApiId == nil {
    51  		return nil, errors.New("invalid value for required argument 'ApiId'")
    52  	}
    53  	opts = internal.PkgResourceDefaultOpts(opts)
    54  	var resource Deployment
    55  	err := ctx.RegisterResource("aws:apigatewayv2/deployment:Deployment", name, args, &resource, opts...)
    56  	if err != nil {
    57  		return nil, err
    58  	}
    59  	return &resource, nil
    60  }
    61  
    62  // GetDeployment gets an existing Deployment resource's state with the given name, ID, and optional
    63  // state properties that are used to uniquely qualify the lookup (nil if not required).
    64  func GetDeployment(ctx *pulumi.Context,
    65  	name string, id pulumi.IDInput, state *DeploymentState, opts ...pulumi.ResourceOption) (*Deployment, error) {
    66  	var resource Deployment
    67  	err := ctx.ReadResource("aws:apigatewayv2/deployment:Deployment", name, id, state, &resource, opts...)
    68  	if err != nil {
    69  		return nil, err
    70  	}
    71  	return &resource, nil
    72  }
    73  
    74  // Input properties used for looking up and filtering Deployment resources.
    75  type deploymentState struct {
    76  	// API identifier.
    77  	ApiId *string `pulumi:"apiId"`
    78  	// Whether the deployment was automatically released.
    79  	AutoDeployed *bool `pulumi:"autoDeployed"`
    80  	// Description for the deployment resource. Must be less than or equal to 1024 characters in length.
    81  	Description *string `pulumi:"description"`
    82  	// Map of arbitrary keys and values that, when changed, will trigger a redeployment.
    83  	Triggers map[string]string `pulumi:"triggers"`
    84  }
    85  
    86  type DeploymentState struct {
    87  	// API identifier.
    88  	ApiId pulumi.StringPtrInput
    89  	// Whether the deployment was automatically released.
    90  	AutoDeployed pulumi.BoolPtrInput
    91  	// Description for the deployment resource. Must be less than or equal to 1024 characters in length.
    92  	Description pulumi.StringPtrInput
    93  	// Map of arbitrary keys and values that, when changed, will trigger a redeployment.
    94  	Triggers pulumi.StringMapInput
    95  }
    96  
    97  func (DeploymentState) ElementType() reflect.Type {
    98  	return reflect.TypeOf((*deploymentState)(nil)).Elem()
    99  }
   100  
   101  type deploymentArgs struct {
   102  	// API identifier.
   103  	ApiId string `pulumi:"apiId"`
   104  	// Description for the deployment resource. Must be less than or equal to 1024 characters in length.
   105  	Description *string `pulumi:"description"`
   106  	// Map of arbitrary keys and values that, when changed, will trigger a redeployment.
   107  	Triggers map[string]string `pulumi:"triggers"`
   108  }
   109  
   110  // The set of arguments for constructing a Deployment resource.
   111  type DeploymentArgs struct {
   112  	// API identifier.
   113  	ApiId pulumi.StringInput
   114  	// Description for the deployment resource. Must be less than or equal to 1024 characters in length.
   115  	Description pulumi.StringPtrInput
   116  	// Map of arbitrary keys and values that, when changed, will trigger a redeployment.
   117  	Triggers pulumi.StringMapInput
   118  }
   119  
   120  func (DeploymentArgs) ElementType() reflect.Type {
   121  	return reflect.TypeOf((*deploymentArgs)(nil)).Elem()
   122  }
   123  
   124  type DeploymentInput interface {
   125  	pulumi.Input
   126  
   127  	ToDeploymentOutput() DeploymentOutput
   128  	ToDeploymentOutputWithContext(ctx context.Context) DeploymentOutput
   129  }
   130  
   131  func (*Deployment) ElementType() reflect.Type {
   132  	return reflect.TypeOf((**Deployment)(nil)).Elem()
   133  }
   134  
   135  func (i *Deployment) ToDeploymentOutput() DeploymentOutput {
   136  	return i.ToDeploymentOutputWithContext(context.Background())
   137  }
   138  
   139  func (i *Deployment) ToDeploymentOutputWithContext(ctx context.Context) DeploymentOutput {
   140  	return pulumi.ToOutputWithContext(ctx, i).(DeploymentOutput)
   141  }
   142  
   143  // DeploymentArrayInput is an input type that accepts DeploymentArray and DeploymentArrayOutput values.
   144  // You can construct a concrete instance of `DeploymentArrayInput` via:
   145  //
   146  //	DeploymentArray{ DeploymentArgs{...} }
   147  type DeploymentArrayInput interface {
   148  	pulumi.Input
   149  
   150  	ToDeploymentArrayOutput() DeploymentArrayOutput
   151  	ToDeploymentArrayOutputWithContext(context.Context) DeploymentArrayOutput
   152  }
   153  
   154  type DeploymentArray []DeploymentInput
   155  
   156  func (DeploymentArray) ElementType() reflect.Type {
   157  	return reflect.TypeOf((*[]*Deployment)(nil)).Elem()
   158  }
   159  
   160  func (i DeploymentArray) ToDeploymentArrayOutput() DeploymentArrayOutput {
   161  	return i.ToDeploymentArrayOutputWithContext(context.Background())
   162  }
   163  
   164  func (i DeploymentArray) ToDeploymentArrayOutputWithContext(ctx context.Context) DeploymentArrayOutput {
   165  	return pulumi.ToOutputWithContext(ctx, i).(DeploymentArrayOutput)
   166  }
   167  
   168  // DeploymentMapInput is an input type that accepts DeploymentMap and DeploymentMapOutput values.
   169  // You can construct a concrete instance of `DeploymentMapInput` via:
   170  //
   171  //	DeploymentMap{ "key": DeploymentArgs{...} }
   172  type DeploymentMapInput interface {
   173  	pulumi.Input
   174  
   175  	ToDeploymentMapOutput() DeploymentMapOutput
   176  	ToDeploymentMapOutputWithContext(context.Context) DeploymentMapOutput
   177  }
   178  
   179  type DeploymentMap map[string]DeploymentInput
   180  
   181  func (DeploymentMap) ElementType() reflect.Type {
   182  	return reflect.TypeOf((*map[string]*Deployment)(nil)).Elem()
   183  }
   184  
   185  func (i DeploymentMap) ToDeploymentMapOutput() DeploymentMapOutput {
   186  	return i.ToDeploymentMapOutputWithContext(context.Background())
   187  }
   188  
   189  func (i DeploymentMap) ToDeploymentMapOutputWithContext(ctx context.Context) DeploymentMapOutput {
   190  	return pulumi.ToOutputWithContext(ctx, i).(DeploymentMapOutput)
   191  }
   192  
   193  type DeploymentOutput struct{ *pulumi.OutputState }
   194  
   195  func (DeploymentOutput) ElementType() reflect.Type {
   196  	return reflect.TypeOf((**Deployment)(nil)).Elem()
   197  }
   198  
   199  func (o DeploymentOutput) ToDeploymentOutput() DeploymentOutput {
   200  	return o
   201  }
   202  
   203  func (o DeploymentOutput) ToDeploymentOutputWithContext(ctx context.Context) DeploymentOutput {
   204  	return o
   205  }
   206  
   207  // API identifier.
   208  func (o DeploymentOutput) ApiId() pulumi.StringOutput {
   209  	return o.ApplyT(func(v *Deployment) pulumi.StringOutput { return v.ApiId }).(pulumi.StringOutput)
   210  }
   211  
   212  // Whether the deployment was automatically released.
   213  func (o DeploymentOutput) AutoDeployed() pulumi.BoolOutput {
   214  	return o.ApplyT(func(v *Deployment) pulumi.BoolOutput { return v.AutoDeployed }).(pulumi.BoolOutput)
   215  }
   216  
   217  // Description for the deployment resource. Must be less than or equal to 1024 characters in length.
   218  func (o DeploymentOutput) Description() pulumi.StringPtrOutput {
   219  	return o.ApplyT(func(v *Deployment) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   220  }
   221  
   222  // Map of arbitrary keys and values that, when changed, will trigger a redeployment.
   223  func (o DeploymentOutput) Triggers() pulumi.StringMapOutput {
   224  	return o.ApplyT(func(v *Deployment) pulumi.StringMapOutput { return v.Triggers }).(pulumi.StringMapOutput)
   225  }
   226  
   227  type DeploymentArrayOutput struct{ *pulumi.OutputState }
   228  
   229  func (DeploymentArrayOutput) ElementType() reflect.Type {
   230  	return reflect.TypeOf((*[]*Deployment)(nil)).Elem()
   231  }
   232  
   233  func (o DeploymentArrayOutput) ToDeploymentArrayOutput() DeploymentArrayOutput {
   234  	return o
   235  }
   236  
   237  func (o DeploymentArrayOutput) ToDeploymentArrayOutputWithContext(ctx context.Context) DeploymentArrayOutput {
   238  	return o
   239  }
   240  
   241  func (o DeploymentArrayOutput) Index(i pulumi.IntInput) DeploymentOutput {
   242  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Deployment {
   243  		return vs[0].([]*Deployment)[vs[1].(int)]
   244  	}).(DeploymentOutput)
   245  }
   246  
   247  type DeploymentMapOutput struct{ *pulumi.OutputState }
   248  
   249  func (DeploymentMapOutput) ElementType() reflect.Type {
   250  	return reflect.TypeOf((*map[string]*Deployment)(nil)).Elem()
   251  }
   252  
   253  func (o DeploymentMapOutput) ToDeploymentMapOutput() DeploymentMapOutput {
   254  	return o
   255  }
   256  
   257  func (o DeploymentMapOutput) ToDeploymentMapOutputWithContext(ctx context.Context) DeploymentMapOutput {
   258  	return o
   259  }
   260  
   261  func (o DeploymentMapOutput) MapIndex(k pulumi.StringInput) DeploymentOutput {
   262  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Deployment {
   263  		return vs[0].(map[string]*Deployment)[vs[1].(string)]
   264  	}).(DeploymentOutput)
   265  }
   266  
   267  func init() {
   268  	pulumi.RegisterInputType(reflect.TypeOf((*DeploymentInput)(nil)).Elem(), &Deployment{})
   269  	pulumi.RegisterInputType(reflect.TypeOf((*DeploymentArrayInput)(nil)).Elem(), DeploymentArray{})
   270  	pulumi.RegisterInputType(reflect.TypeOf((*DeploymentMapInput)(nil)).Elem(), DeploymentMap{})
   271  	pulumi.RegisterOutputType(DeploymentOutput{})
   272  	pulumi.RegisterOutputType(DeploymentArrayOutput{})
   273  	pulumi.RegisterOutputType(DeploymentMapOutput{})
   274  }