github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apigateway/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 apigateway
     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 API Gateway REST Deployment. A deployment is a snapshot of the REST API configuration. The deployment can then be published to callable endpoints via the `apigateway.Stage` resource and optionally managed further with the `apigateway.BasePathMapping` resource, `apigateway.DomainName` resource, and `awsApiMethodSettings` resource. For more information, see the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-deploy-api.html).
    16  //
    17  // To properly capture all REST API configuration in a deployment, this resource must have dependencies on all prior resources that manage resources/paths, methods, integrations, etc.
    18  //
    19  // * For REST APIs that are configured via OpenAPI specification (`apigateway.RestApi` resource `body` argument), no special dependency setup is needed beyond referencing the  `id` attribute of that resource unless additional resources have further customized the REST API.
    20  // * When the REST API configuration involves other resources (`apigateway.Integration` resource), the dependency setup can be done with implicit resource references in the `triggers` argument or explicit resource references using the [resource `dependsOn` custom option](https://www.pulumi.com/docs/intro/concepts/resources/#dependson). The `triggers` argument should be preferred over `dependsOn`, since `dependsOn` can only capture dependency ordering and will not cause the resource to recreate (redeploy the REST API) with upstream configuration changes.
    21  //
    22  // !> **WARNING:** It is recommended to use the `apigateway.Stage` resource instead of managing an API Gateway Stage via the `stageName` argument of this resource. When this resource is recreated (REST API redeployment) with the `stageName` configured, the stage is deleted and recreated. This will cause a temporary service interruption, increase provide plan differences, and can require a second apply to recreate any downstream stage configuration such as associated `awsApiMethodSettings` resources.
    23  //
    24  // ## Example Usage
    25  //
    26  // ## Import
    27  //
    28  // Using `pulumi import`, import `aws_api_gateway_deployment` using `REST-API-ID/DEPLOYMENT-ID`. For example:
    29  //
    30  // ```sh
    31  // $ pulumi import aws:apigateway/deployment:Deployment example aabbccddee/1122334
    32  // ```
    33  // The `stage_name`, `stage_description`, and `variables` arguments cannot be imported. Use the `aws_api_gateway_stage` resource to import and manage stages.
    34  //
    35  // The `triggers` argument cannot be imported.
    36  type Deployment struct {
    37  	pulumi.CustomResourceState
    38  
    39  	// Creation date of the deployment
    40  	CreatedDate pulumi.StringOutput `pulumi:"createdDate"`
    41  	// Description of the deployment
    42  	Description pulumi.StringPtrOutput `pulumi:"description"`
    43  	// Execution ARN to be used in `lambdaPermission`'s `sourceArn`
    44  	// when allowing API Gateway to invoke a Lambda function,
    45  	// e.g., `arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod`
    46  	ExecutionArn pulumi.StringOutput `pulumi:"executionArn"`
    47  	// URL to invoke the API pointing to the stage,
    48  	// e.g., `https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod`
    49  	InvokeUrl pulumi.StringOutput `pulumi:"invokeUrl"`
    50  	// REST API identifier.
    51  	RestApi pulumi.StringOutput `pulumi:"restApi"`
    52  	// Description to set on the stage managed by the `stageName` argument.
    53  	StageDescription pulumi.StringPtrOutput `pulumi:"stageDescription"`
    54  	// Name of the stage to create with this deployment. If the specified stage already exists, it will be updated to point to the new deployment. We recommend using the `apigateway.Stage` resource instead to manage stages.
    55  	StageName pulumi.StringPtrOutput `pulumi:"stageName"`
    56  	// Map of arbitrary keys and values that, when changed, will trigger a redeployment.
    57  	Triggers pulumi.StringMapOutput `pulumi:"triggers"`
    58  	// Map to set on the stage managed by the `stageName` argument.
    59  	Variables pulumi.StringMapOutput `pulumi:"variables"`
    60  }
    61  
    62  // NewDeployment registers a new resource with the given unique name, arguments, and options.
    63  func NewDeployment(ctx *pulumi.Context,
    64  	name string, args *DeploymentArgs, opts ...pulumi.ResourceOption) (*Deployment, error) {
    65  	if args == nil {
    66  		return nil, errors.New("missing one or more required arguments")
    67  	}
    68  
    69  	if args.RestApi == nil {
    70  		return nil, errors.New("invalid value for required argument 'RestApi'")
    71  	}
    72  	opts = internal.PkgResourceDefaultOpts(opts)
    73  	var resource Deployment
    74  	err := ctx.RegisterResource("aws:apigateway/deployment:Deployment", name, args, &resource, opts...)
    75  	if err != nil {
    76  		return nil, err
    77  	}
    78  	return &resource, nil
    79  }
    80  
    81  // GetDeployment gets an existing Deployment resource's state with the given name, ID, and optional
    82  // state properties that are used to uniquely qualify the lookup (nil if not required).
    83  func GetDeployment(ctx *pulumi.Context,
    84  	name string, id pulumi.IDInput, state *DeploymentState, opts ...pulumi.ResourceOption) (*Deployment, error) {
    85  	var resource Deployment
    86  	err := ctx.ReadResource("aws:apigateway/deployment:Deployment", name, id, state, &resource, opts...)
    87  	if err != nil {
    88  		return nil, err
    89  	}
    90  	return &resource, nil
    91  }
    92  
    93  // Input properties used for looking up and filtering Deployment resources.
    94  type deploymentState struct {
    95  	// Creation date of the deployment
    96  	CreatedDate *string `pulumi:"createdDate"`
    97  	// Description of the deployment
    98  	Description *string `pulumi:"description"`
    99  	// Execution ARN to be used in `lambdaPermission`'s `sourceArn`
   100  	// when allowing API Gateway to invoke a Lambda function,
   101  	// e.g., `arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod`
   102  	ExecutionArn *string `pulumi:"executionArn"`
   103  	// URL to invoke the API pointing to the stage,
   104  	// e.g., `https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod`
   105  	InvokeUrl *string `pulumi:"invokeUrl"`
   106  	// REST API identifier.
   107  	RestApi interface{} `pulumi:"restApi"`
   108  	// Description to set on the stage managed by the `stageName` argument.
   109  	StageDescription *string `pulumi:"stageDescription"`
   110  	// Name of the stage to create with this deployment. If the specified stage already exists, it will be updated to point to the new deployment. We recommend using the `apigateway.Stage` resource instead to manage stages.
   111  	StageName *string `pulumi:"stageName"`
   112  	// Map of arbitrary keys and values that, when changed, will trigger a redeployment.
   113  	Triggers map[string]string `pulumi:"triggers"`
   114  	// Map to set on the stage managed by the `stageName` argument.
   115  	Variables map[string]string `pulumi:"variables"`
   116  }
   117  
   118  type DeploymentState struct {
   119  	// Creation date of the deployment
   120  	CreatedDate pulumi.StringPtrInput
   121  	// Description of the deployment
   122  	Description pulumi.StringPtrInput
   123  	// Execution ARN to be used in `lambdaPermission`'s `sourceArn`
   124  	// when allowing API Gateway to invoke a Lambda function,
   125  	// e.g., `arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod`
   126  	ExecutionArn pulumi.StringPtrInput
   127  	// URL to invoke the API pointing to the stage,
   128  	// e.g., `https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod`
   129  	InvokeUrl pulumi.StringPtrInput
   130  	// REST API identifier.
   131  	RestApi pulumi.Input
   132  	// Description to set on the stage managed by the `stageName` argument.
   133  	StageDescription pulumi.StringPtrInput
   134  	// Name of the stage to create with this deployment. If the specified stage already exists, it will be updated to point to the new deployment. We recommend using the `apigateway.Stage` resource instead to manage stages.
   135  	StageName pulumi.StringPtrInput
   136  	// Map of arbitrary keys and values that, when changed, will trigger a redeployment.
   137  	Triggers pulumi.StringMapInput
   138  	// Map to set on the stage managed by the `stageName` argument.
   139  	Variables pulumi.StringMapInput
   140  }
   141  
   142  func (DeploymentState) ElementType() reflect.Type {
   143  	return reflect.TypeOf((*deploymentState)(nil)).Elem()
   144  }
   145  
   146  type deploymentArgs struct {
   147  	// Description of the deployment
   148  	Description *string `pulumi:"description"`
   149  	// REST API identifier.
   150  	RestApi interface{} `pulumi:"restApi"`
   151  	// Description to set on the stage managed by the `stageName` argument.
   152  	StageDescription *string `pulumi:"stageDescription"`
   153  	// Name of the stage to create with this deployment. If the specified stage already exists, it will be updated to point to the new deployment. We recommend using the `apigateway.Stage` resource instead to manage stages.
   154  	StageName *string `pulumi:"stageName"`
   155  	// Map of arbitrary keys and values that, when changed, will trigger a redeployment.
   156  	Triggers map[string]string `pulumi:"triggers"`
   157  	// Map to set on the stage managed by the `stageName` argument.
   158  	Variables map[string]string `pulumi:"variables"`
   159  }
   160  
   161  // The set of arguments for constructing a Deployment resource.
   162  type DeploymentArgs struct {
   163  	// Description of the deployment
   164  	Description pulumi.StringPtrInput
   165  	// REST API identifier.
   166  	RestApi pulumi.Input
   167  	// Description to set on the stage managed by the `stageName` argument.
   168  	StageDescription pulumi.StringPtrInput
   169  	// Name of the stage to create with this deployment. If the specified stage already exists, it will be updated to point to the new deployment. We recommend using the `apigateway.Stage` resource instead to manage stages.
   170  	StageName pulumi.StringPtrInput
   171  	// Map of arbitrary keys and values that, when changed, will trigger a redeployment.
   172  	Triggers pulumi.StringMapInput
   173  	// Map to set on the stage managed by the `stageName` argument.
   174  	Variables pulumi.StringMapInput
   175  }
   176  
   177  func (DeploymentArgs) ElementType() reflect.Type {
   178  	return reflect.TypeOf((*deploymentArgs)(nil)).Elem()
   179  }
   180  
   181  type DeploymentInput interface {
   182  	pulumi.Input
   183  
   184  	ToDeploymentOutput() DeploymentOutput
   185  	ToDeploymentOutputWithContext(ctx context.Context) DeploymentOutput
   186  }
   187  
   188  func (*Deployment) ElementType() reflect.Type {
   189  	return reflect.TypeOf((**Deployment)(nil)).Elem()
   190  }
   191  
   192  func (i *Deployment) ToDeploymentOutput() DeploymentOutput {
   193  	return i.ToDeploymentOutputWithContext(context.Background())
   194  }
   195  
   196  func (i *Deployment) ToDeploymentOutputWithContext(ctx context.Context) DeploymentOutput {
   197  	return pulumi.ToOutputWithContext(ctx, i).(DeploymentOutput)
   198  }
   199  
   200  // DeploymentArrayInput is an input type that accepts DeploymentArray and DeploymentArrayOutput values.
   201  // You can construct a concrete instance of `DeploymentArrayInput` via:
   202  //
   203  //	DeploymentArray{ DeploymentArgs{...} }
   204  type DeploymentArrayInput interface {
   205  	pulumi.Input
   206  
   207  	ToDeploymentArrayOutput() DeploymentArrayOutput
   208  	ToDeploymentArrayOutputWithContext(context.Context) DeploymentArrayOutput
   209  }
   210  
   211  type DeploymentArray []DeploymentInput
   212  
   213  func (DeploymentArray) ElementType() reflect.Type {
   214  	return reflect.TypeOf((*[]*Deployment)(nil)).Elem()
   215  }
   216  
   217  func (i DeploymentArray) ToDeploymentArrayOutput() DeploymentArrayOutput {
   218  	return i.ToDeploymentArrayOutputWithContext(context.Background())
   219  }
   220  
   221  func (i DeploymentArray) ToDeploymentArrayOutputWithContext(ctx context.Context) DeploymentArrayOutput {
   222  	return pulumi.ToOutputWithContext(ctx, i).(DeploymentArrayOutput)
   223  }
   224  
   225  // DeploymentMapInput is an input type that accepts DeploymentMap and DeploymentMapOutput values.
   226  // You can construct a concrete instance of `DeploymentMapInput` via:
   227  //
   228  //	DeploymentMap{ "key": DeploymentArgs{...} }
   229  type DeploymentMapInput interface {
   230  	pulumi.Input
   231  
   232  	ToDeploymentMapOutput() DeploymentMapOutput
   233  	ToDeploymentMapOutputWithContext(context.Context) DeploymentMapOutput
   234  }
   235  
   236  type DeploymentMap map[string]DeploymentInput
   237  
   238  func (DeploymentMap) ElementType() reflect.Type {
   239  	return reflect.TypeOf((*map[string]*Deployment)(nil)).Elem()
   240  }
   241  
   242  func (i DeploymentMap) ToDeploymentMapOutput() DeploymentMapOutput {
   243  	return i.ToDeploymentMapOutputWithContext(context.Background())
   244  }
   245  
   246  func (i DeploymentMap) ToDeploymentMapOutputWithContext(ctx context.Context) DeploymentMapOutput {
   247  	return pulumi.ToOutputWithContext(ctx, i).(DeploymentMapOutput)
   248  }
   249  
   250  type DeploymentOutput struct{ *pulumi.OutputState }
   251  
   252  func (DeploymentOutput) ElementType() reflect.Type {
   253  	return reflect.TypeOf((**Deployment)(nil)).Elem()
   254  }
   255  
   256  func (o DeploymentOutput) ToDeploymentOutput() DeploymentOutput {
   257  	return o
   258  }
   259  
   260  func (o DeploymentOutput) ToDeploymentOutputWithContext(ctx context.Context) DeploymentOutput {
   261  	return o
   262  }
   263  
   264  // Creation date of the deployment
   265  func (o DeploymentOutput) CreatedDate() pulumi.StringOutput {
   266  	return o.ApplyT(func(v *Deployment) pulumi.StringOutput { return v.CreatedDate }).(pulumi.StringOutput)
   267  }
   268  
   269  // Description of the deployment
   270  func (o DeploymentOutput) Description() pulumi.StringPtrOutput {
   271  	return o.ApplyT(func(v *Deployment) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   272  }
   273  
   274  // Execution ARN to be used in `lambdaPermission`'s `sourceArn`
   275  // when allowing API Gateway to invoke a Lambda function,
   276  // e.g., `arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod`
   277  func (o DeploymentOutput) ExecutionArn() pulumi.StringOutput {
   278  	return o.ApplyT(func(v *Deployment) pulumi.StringOutput { return v.ExecutionArn }).(pulumi.StringOutput)
   279  }
   280  
   281  // URL to invoke the API pointing to the stage,
   282  // e.g., `https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod`
   283  func (o DeploymentOutput) InvokeUrl() pulumi.StringOutput {
   284  	return o.ApplyT(func(v *Deployment) pulumi.StringOutput { return v.InvokeUrl }).(pulumi.StringOutput)
   285  }
   286  
   287  // REST API identifier.
   288  func (o DeploymentOutput) RestApi() pulumi.StringOutput {
   289  	return o.ApplyT(func(v *Deployment) pulumi.StringOutput { return v.RestApi }).(pulumi.StringOutput)
   290  }
   291  
   292  // Description to set on the stage managed by the `stageName` argument.
   293  func (o DeploymentOutput) StageDescription() pulumi.StringPtrOutput {
   294  	return o.ApplyT(func(v *Deployment) pulumi.StringPtrOutput { return v.StageDescription }).(pulumi.StringPtrOutput)
   295  }
   296  
   297  // Name of the stage to create with this deployment. If the specified stage already exists, it will be updated to point to the new deployment. We recommend using the `apigateway.Stage` resource instead to manage stages.
   298  func (o DeploymentOutput) StageName() pulumi.StringPtrOutput {
   299  	return o.ApplyT(func(v *Deployment) pulumi.StringPtrOutput { return v.StageName }).(pulumi.StringPtrOutput)
   300  }
   301  
   302  // Map of arbitrary keys and values that, when changed, will trigger a redeployment.
   303  func (o DeploymentOutput) Triggers() pulumi.StringMapOutput {
   304  	return o.ApplyT(func(v *Deployment) pulumi.StringMapOutput { return v.Triggers }).(pulumi.StringMapOutput)
   305  }
   306  
   307  // Map to set on the stage managed by the `stageName` argument.
   308  func (o DeploymentOutput) Variables() pulumi.StringMapOutput {
   309  	return o.ApplyT(func(v *Deployment) pulumi.StringMapOutput { return v.Variables }).(pulumi.StringMapOutput)
   310  }
   311  
   312  type DeploymentArrayOutput struct{ *pulumi.OutputState }
   313  
   314  func (DeploymentArrayOutput) ElementType() reflect.Type {
   315  	return reflect.TypeOf((*[]*Deployment)(nil)).Elem()
   316  }
   317  
   318  func (o DeploymentArrayOutput) ToDeploymentArrayOutput() DeploymentArrayOutput {
   319  	return o
   320  }
   321  
   322  func (o DeploymentArrayOutput) ToDeploymentArrayOutputWithContext(ctx context.Context) DeploymentArrayOutput {
   323  	return o
   324  }
   325  
   326  func (o DeploymentArrayOutput) Index(i pulumi.IntInput) DeploymentOutput {
   327  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Deployment {
   328  		return vs[0].([]*Deployment)[vs[1].(int)]
   329  	}).(DeploymentOutput)
   330  }
   331  
   332  type DeploymentMapOutput struct{ *pulumi.OutputState }
   333  
   334  func (DeploymentMapOutput) ElementType() reflect.Type {
   335  	return reflect.TypeOf((*map[string]*Deployment)(nil)).Elem()
   336  }
   337  
   338  func (o DeploymentMapOutput) ToDeploymentMapOutput() DeploymentMapOutput {
   339  	return o
   340  }
   341  
   342  func (o DeploymentMapOutput) ToDeploymentMapOutputWithContext(ctx context.Context) DeploymentMapOutput {
   343  	return o
   344  }
   345  
   346  func (o DeploymentMapOutput) MapIndex(k pulumi.StringInput) DeploymentOutput {
   347  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Deployment {
   348  		return vs[0].(map[string]*Deployment)[vs[1].(string)]
   349  	}).(DeploymentOutput)
   350  }
   351  
   352  func init() {
   353  	pulumi.RegisterInputType(reflect.TypeOf((*DeploymentInput)(nil)).Elem(), &Deployment{})
   354  	pulumi.RegisterInputType(reflect.TypeOf((*DeploymentArrayInput)(nil)).Elem(), DeploymentArray{})
   355  	pulumi.RegisterInputType(reflect.TypeOf((*DeploymentMapInput)(nil)).Elem(), DeploymentMap{})
   356  	pulumi.RegisterOutputType(DeploymentOutput{})
   357  	pulumi.RegisterOutputType(DeploymentArrayOutput{})
   358  	pulumi.RegisterOutputType(DeploymentMapOutput{})
   359  }