github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/amplify/branch.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 amplify
     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 Amplify Branch resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amplify"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			example, err := amplify.NewApp(ctx, "example", &amplify.AppArgs{
    33  //				Name: pulumi.String("app"),
    34  //			})
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			_, err = amplify.NewBranch(ctx, "master", &amplify.BranchArgs{
    39  //				AppId:      example.ID(),
    40  //				BranchName: pulumi.String("master"),
    41  //				Framework:  pulumi.String("React"),
    42  //				Stage:      pulumi.String("PRODUCTION"),
    43  //				EnvironmentVariables: pulumi.StringMap{
    44  //					"REACT_APP_API_SERVER": pulumi.String("https://api.example.com"),
    45  //				},
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  //
    57  // ### Basic Authentication
    58  //
    59  // <!--Start PulumiCodeChooser -->
    60  // ```go
    61  // package main
    62  //
    63  // import (
    64  //
    65  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amplify"
    66  //	"github.com/pulumi/pulumi-std/sdk/go/std"
    67  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    68  //
    69  // )
    70  //
    71  //	func main() {
    72  //		pulumi.Run(func(ctx *pulumi.Context) error {
    73  //			example, err := amplify.NewApp(ctx, "example", &amplify.AppArgs{
    74  //				Name: pulumi.String("app"),
    75  //			})
    76  //			if err != nil {
    77  //				return err
    78  //			}
    79  //			invokeBase64encode, err := std.Base64encode(ctx, &std.Base64encodeArgs{
    80  //				Input: "username:password",
    81  //			}, nil)
    82  //			if err != nil {
    83  //				return err
    84  //			}
    85  //			_, err = amplify.NewBranch(ctx, "master", &amplify.BranchArgs{
    86  //				AppId:                example.ID(),
    87  //				BranchName:           pulumi.String("master"),
    88  //				EnableBasicAuth:      pulumi.Bool(true),
    89  //				BasicAuthCredentials: invokeBase64encode.Result,
    90  //			})
    91  //			if err != nil {
    92  //				return err
    93  //			}
    94  //			return nil
    95  //		})
    96  //	}
    97  //
    98  // ```
    99  // <!--End PulumiCodeChooser -->
   100  //
   101  // ### Notifications
   102  //
   103  // Amplify Console uses EventBridge (formerly known as CloudWatch Events) and SNS for email notifications.  To implement the same functionality, you need to set `enableNotification` in a `amplify.Branch` resource, as well as creating an EventBridge Rule, an SNS topic, and SNS subscriptions.
   104  //
   105  // <!--Start PulumiCodeChooser -->
   106  // ```go
   107  // package main
   108  //
   109  // import (
   110  //
   111  //	"encoding/json"
   112  //	"fmt"
   113  //
   114  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amplify"
   115  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
   116  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
   117  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
   118  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   119  //
   120  // )
   121  // func main() {
   122  // pulumi.Run(func(ctx *pulumi.Context) error {
   123  // example, err := amplify.NewApp(ctx, "example", &amplify.AppArgs{
   124  // Name: pulumi.String("app"),
   125  // })
   126  // if err != nil {
   127  // return err
   128  // }
   129  // master, err := amplify.NewBranch(ctx, "master", &amplify.BranchArgs{
   130  // AppId: example.ID(),
   131  // BranchName: pulumi.String("master"),
   132  // EnableNotification: pulumi.Bool(true),
   133  // })
   134  // if err != nil {
   135  // return err
   136  // }
   137  // // EventBridge Rule for Amplify notifications
   138  // amplifyAppMasterEventRule, err := cloudwatch.NewEventRule(ctx, "amplify_app_master", &cloudwatch.EventRuleArgs{
   139  // Name: master.BranchName.ApplyT(func(branchName string) (string, error) {
   140  // return fmt.Sprintf("amplify-%v-%v-branch-notification", app.Id, branchName), nil
   141  // }).(pulumi.StringOutput),
   142  // Description: master.BranchName.ApplyT(func(branchName string) (string, error) {
   143  // return fmt.Sprintf("AWS Amplify build notifications for :  App: %v Branch: %v", app.Id, branchName), nil
   144  // }).(pulumi.StringOutput),
   145  // EventPattern: pulumi.All(example.ID(),master.BranchName).ApplyT(func(_args []interface{}) (string, error) {
   146  // id := _args[0].(string)
   147  // branchName := _args[1].(string)
   148  // var _zero string
   149  // tmpJSON0, err := json.Marshal(map[string]interface{}{
   150  // "detail": map[string]interface{}{
   151  // "appId": []string{
   152  // id,
   153  // },
   154  // "branchName": []string{
   155  // branchName,
   156  // },
   157  // "jobStatus": []string{
   158  // "SUCCEED",
   159  // "FAILED",
   160  // "STARTED",
   161  // },
   162  // },
   163  // "detail-type": []string{
   164  // "Amplify Deployment Status Change",
   165  // },
   166  // "source": []string{
   167  // "aws.amplify",
   168  // },
   169  // })
   170  // if err != nil {
   171  // return _zero, err
   172  // }
   173  // json0 := string(tmpJSON0)
   174  // return json0, nil
   175  // }).(pulumi.StringOutput),
   176  // })
   177  // if err != nil {
   178  // return err
   179  // }
   180  // // SNS Topic for Amplify notifications
   181  // amplifyAppMasterTopic, err := sns.NewTopic(ctx, "amplify_app_master", &sns.TopicArgs{
   182  // Name: master.BranchName.ApplyT(func(branchName string) (string, error) {
   183  // return fmt.Sprintf("amplify-%v_%v", app.Id, branchName), nil
   184  // }).(pulumi.StringOutput),
   185  // })
   186  // if err != nil {
   187  // return err
   188  // }
   189  // _, err = cloudwatch.NewEventTarget(ctx, "amplify_app_master", &cloudwatch.EventTargetArgs{
   190  // Rule: amplifyAppMasterEventRule.Name,
   191  // TargetId: master.BranchName,
   192  // Arn: amplifyAppMasterTopic.Arn,
   193  // InputTransformer: &cloudwatch.EventTargetInputTransformerArgs{
   194  // InputPaths: pulumi.StringMap{
   195  // "jobId": pulumi.String("$.detail.jobId"),
   196  // "appId": pulumi.String("$.detail.appId"),
   197  // "region": pulumi.String("$.region"),
   198  // "branch": pulumi.String("$.detail.branchName"),
   199  // "status": pulumi.String("$.detail.jobStatus"),
   200  // },
   201  // InputTemplate: pulumi.String("\"Build notification from the AWS Amplify Console for app: https://<branch>.<appId>.amplifyapp.com/. Your build status is <status>. Go to https://console.aws.amazon.com/amplify/home?region=<region>#<appId>/<branch>/<jobId> to view details on your build. \""),
   202  // },
   203  // })
   204  // if err != nil {
   205  // return err
   206  // }
   207  // amplifyAppMaster := pulumi.All(master.Arn,amplifyAppMasterTopic.Arn).ApplyT(func(_args []interface{}) (iam.GetPolicyDocumentResult, error) {
   208  // masterArn := _args[0].(string)
   209  // amplifyAppMasterTopicArn := _args[1].(string)
   210  // return iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
   211  // Statements: []iam.GetPolicyDocumentStatement{
   212  // {
   213  // Sid: fmt.Sprintf("Allow_Publish_Events %v", masterArn),
   214  // Effect: "Allow",
   215  // Actions: []string{
   216  // "SNS:Publish",
   217  // },
   218  // Principals: []iam.GetPolicyDocumentStatementPrincipal{
   219  // {
   220  // Type: "Service",
   221  // Identifiers: []string{
   222  // "events.amazonaws.com",
   223  // },
   224  // },
   225  // },
   226  // Resources: interface{}{
   227  // amplifyAppMasterTopicArn,
   228  // },
   229  // },
   230  // },
   231  // }, nil), nil
   232  // }).(iam.GetPolicyDocumentResultOutput)
   233  // _, err = sns.NewTopicPolicy(ctx, "amplify_app_master", &sns.TopicPolicyArgs{
   234  // Arn: amplifyAppMasterTopic.Arn,
   235  // Policy: amplifyAppMaster.ApplyT(func(amplifyAppMaster iam.GetPolicyDocumentResult) (*string, error) {
   236  // return &amplifyAppMaster.Json, nil
   237  // }).(pulumi.StringPtrOutput),
   238  // })
   239  // if err != nil {
   240  // return err
   241  // }
   242  // _, err = sns.NewTopicSubscription(ctx, "this", &sns.TopicSubscriptionArgs{
   243  // Topic: amplifyAppMasterTopic.Arn,
   244  // Protocol: pulumi.String("email"),
   245  // Endpoint: pulumi.String("user@acme.com"),
   246  // })
   247  // if err != nil {
   248  // return err
   249  // }
   250  // return nil
   251  // })
   252  // }
   253  // ```
   254  // <!--End PulumiCodeChooser -->
   255  //
   256  // ## Import
   257  //
   258  // Using `pulumi import`, import Amplify branch using `app_id` and `branch_name`. For example:
   259  //
   260  // ```sh
   261  // $ pulumi import aws:amplify/branch:Branch master d2ypk4k47z8u6/master
   262  // ```
   263  type Branch struct {
   264  	pulumi.CustomResourceState
   265  
   266  	// Unique ID for an Amplify app.
   267  	AppId pulumi.StringOutput `pulumi:"appId"`
   268  	// ARN for the branch.
   269  	Arn pulumi.StringOutput `pulumi:"arn"`
   270  	// A list of custom resources that are linked to this branch.
   271  	AssociatedResources pulumi.StringArrayOutput `pulumi:"associatedResources"`
   272  	// ARN for a backend environment that is part of an Amplify app.
   273  	BackendEnvironmentArn pulumi.StringPtrOutput `pulumi:"backendEnvironmentArn"`
   274  	// Basic authorization credentials for the branch.
   275  	BasicAuthCredentials pulumi.StringPtrOutput `pulumi:"basicAuthCredentials"`
   276  	// Name for the branch.
   277  	BranchName pulumi.StringOutput `pulumi:"branchName"`
   278  	// Custom domains for the branch.
   279  	CustomDomains pulumi.StringArrayOutput `pulumi:"customDomains"`
   280  	// Description for the branch.
   281  	Description pulumi.StringPtrOutput `pulumi:"description"`
   282  	// Destination branch if the branch is a pull request branch.
   283  	DestinationBranch pulumi.StringOutput `pulumi:"destinationBranch"`
   284  	// Display name for a branch. This is used as the default domain prefix.
   285  	DisplayName pulumi.StringOutput `pulumi:"displayName"`
   286  	// Enables auto building for the branch.
   287  	EnableAutoBuild pulumi.BoolPtrOutput `pulumi:"enableAutoBuild"`
   288  	// Enables basic authorization for the branch.
   289  	EnableBasicAuth pulumi.BoolPtrOutput `pulumi:"enableBasicAuth"`
   290  	// Enables notifications for the branch.
   291  	EnableNotification pulumi.BoolPtrOutput `pulumi:"enableNotification"`
   292  	// Enables performance mode for the branch.
   293  	EnablePerformanceMode pulumi.BoolPtrOutput `pulumi:"enablePerformanceMode"`
   294  	// Enables pull request previews for this branch.
   295  	EnablePullRequestPreview pulumi.BoolPtrOutput `pulumi:"enablePullRequestPreview"`
   296  	// Environment variables for the branch.
   297  	EnvironmentVariables pulumi.StringMapOutput `pulumi:"environmentVariables"`
   298  	// Framework for the branch.
   299  	Framework pulumi.StringPtrOutput `pulumi:"framework"`
   300  	// Amplify environment name for the pull request.
   301  	PullRequestEnvironmentName pulumi.StringPtrOutput `pulumi:"pullRequestEnvironmentName"`
   302  	// Source branch if the branch is a pull request branch.
   303  	SourceBranch pulumi.StringOutput `pulumi:"sourceBranch"`
   304  	// Describes the current stage for the branch. Valid values: `PRODUCTION`, `BETA`, `DEVELOPMENT`, `EXPERIMENTAL`, `PULL_REQUEST`.
   305  	Stage pulumi.StringPtrOutput `pulumi:"stage"`
   306  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   307  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   308  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   309  	//
   310  	// Deprecated: Please use `tags` instead.
   311  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   312  	// Content Time To Live (TTL) for the website in seconds.
   313  	Ttl pulumi.StringPtrOutput `pulumi:"ttl"`
   314  }
   315  
   316  // NewBranch registers a new resource with the given unique name, arguments, and options.
   317  func NewBranch(ctx *pulumi.Context,
   318  	name string, args *BranchArgs, opts ...pulumi.ResourceOption) (*Branch, error) {
   319  	if args == nil {
   320  		return nil, errors.New("missing one or more required arguments")
   321  	}
   322  
   323  	if args.AppId == nil {
   324  		return nil, errors.New("invalid value for required argument 'AppId'")
   325  	}
   326  	if args.BranchName == nil {
   327  		return nil, errors.New("invalid value for required argument 'BranchName'")
   328  	}
   329  	if args.BasicAuthCredentials != nil {
   330  		args.BasicAuthCredentials = pulumi.ToSecret(args.BasicAuthCredentials).(pulumi.StringPtrInput)
   331  	}
   332  	secrets := pulumi.AdditionalSecretOutputs([]string{
   333  		"basicAuthCredentials",
   334  	})
   335  	opts = append(opts, secrets)
   336  	opts = internal.PkgResourceDefaultOpts(opts)
   337  	var resource Branch
   338  	err := ctx.RegisterResource("aws:amplify/branch:Branch", name, args, &resource, opts...)
   339  	if err != nil {
   340  		return nil, err
   341  	}
   342  	return &resource, nil
   343  }
   344  
   345  // GetBranch gets an existing Branch resource's state with the given name, ID, and optional
   346  // state properties that are used to uniquely qualify the lookup (nil if not required).
   347  func GetBranch(ctx *pulumi.Context,
   348  	name string, id pulumi.IDInput, state *BranchState, opts ...pulumi.ResourceOption) (*Branch, error) {
   349  	var resource Branch
   350  	err := ctx.ReadResource("aws:amplify/branch:Branch", name, id, state, &resource, opts...)
   351  	if err != nil {
   352  		return nil, err
   353  	}
   354  	return &resource, nil
   355  }
   356  
   357  // Input properties used for looking up and filtering Branch resources.
   358  type branchState struct {
   359  	// Unique ID for an Amplify app.
   360  	AppId *string `pulumi:"appId"`
   361  	// ARN for the branch.
   362  	Arn *string `pulumi:"arn"`
   363  	// A list of custom resources that are linked to this branch.
   364  	AssociatedResources []string `pulumi:"associatedResources"`
   365  	// ARN for a backend environment that is part of an Amplify app.
   366  	BackendEnvironmentArn *string `pulumi:"backendEnvironmentArn"`
   367  	// Basic authorization credentials for the branch.
   368  	BasicAuthCredentials *string `pulumi:"basicAuthCredentials"`
   369  	// Name for the branch.
   370  	BranchName *string `pulumi:"branchName"`
   371  	// Custom domains for the branch.
   372  	CustomDomains []string `pulumi:"customDomains"`
   373  	// Description for the branch.
   374  	Description *string `pulumi:"description"`
   375  	// Destination branch if the branch is a pull request branch.
   376  	DestinationBranch *string `pulumi:"destinationBranch"`
   377  	// Display name for a branch. This is used as the default domain prefix.
   378  	DisplayName *string `pulumi:"displayName"`
   379  	// Enables auto building for the branch.
   380  	EnableAutoBuild *bool `pulumi:"enableAutoBuild"`
   381  	// Enables basic authorization for the branch.
   382  	EnableBasicAuth *bool `pulumi:"enableBasicAuth"`
   383  	// Enables notifications for the branch.
   384  	EnableNotification *bool `pulumi:"enableNotification"`
   385  	// Enables performance mode for the branch.
   386  	EnablePerformanceMode *bool `pulumi:"enablePerformanceMode"`
   387  	// Enables pull request previews for this branch.
   388  	EnablePullRequestPreview *bool `pulumi:"enablePullRequestPreview"`
   389  	// Environment variables for the branch.
   390  	EnvironmentVariables map[string]string `pulumi:"environmentVariables"`
   391  	// Framework for the branch.
   392  	Framework *string `pulumi:"framework"`
   393  	// Amplify environment name for the pull request.
   394  	PullRequestEnvironmentName *string `pulumi:"pullRequestEnvironmentName"`
   395  	// Source branch if the branch is a pull request branch.
   396  	SourceBranch *string `pulumi:"sourceBranch"`
   397  	// Describes the current stage for the branch. Valid values: `PRODUCTION`, `BETA`, `DEVELOPMENT`, `EXPERIMENTAL`, `PULL_REQUEST`.
   398  	Stage *string `pulumi:"stage"`
   399  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   400  	Tags map[string]string `pulumi:"tags"`
   401  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   402  	//
   403  	// Deprecated: Please use `tags` instead.
   404  	TagsAll map[string]string `pulumi:"tagsAll"`
   405  	// Content Time To Live (TTL) for the website in seconds.
   406  	Ttl *string `pulumi:"ttl"`
   407  }
   408  
   409  type BranchState struct {
   410  	// Unique ID for an Amplify app.
   411  	AppId pulumi.StringPtrInput
   412  	// ARN for the branch.
   413  	Arn pulumi.StringPtrInput
   414  	// A list of custom resources that are linked to this branch.
   415  	AssociatedResources pulumi.StringArrayInput
   416  	// ARN for a backend environment that is part of an Amplify app.
   417  	BackendEnvironmentArn pulumi.StringPtrInput
   418  	// Basic authorization credentials for the branch.
   419  	BasicAuthCredentials pulumi.StringPtrInput
   420  	// Name for the branch.
   421  	BranchName pulumi.StringPtrInput
   422  	// Custom domains for the branch.
   423  	CustomDomains pulumi.StringArrayInput
   424  	// Description for the branch.
   425  	Description pulumi.StringPtrInput
   426  	// Destination branch if the branch is a pull request branch.
   427  	DestinationBranch pulumi.StringPtrInput
   428  	// Display name for a branch. This is used as the default domain prefix.
   429  	DisplayName pulumi.StringPtrInput
   430  	// Enables auto building for the branch.
   431  	EnableAutoBuild pulumi.BoolPtrInput
   432  	// Enables basic authorization for the branch.
   433  	EnableBasicAuth pulumi.BoolPtrInput
   434  	// Enables notifications for the branch.
   435  	EnableNotification pulumi.BoolPtrInput
   436  	// Enables performance mode for the branch.
   437  	EnablePerformanceMode pulumi.BoolPtrInput
   438  	// Enables pull request previews for this branch.
   439  	EnablePullRequestPreview pulumi.BoolPtrInput
   440  	// Environment variables for the branch.
   441  	EnvironmentVariables pulumi.StringMapInput
   442  	// Framework for the branch.
   443  	Framework pulumi.StringPtrInput
   444  	// Amplify environment name for the pull request.
   445  	PullRequestEnvironmentName pulumi.StringPtrInput
   446  	// Source branch if the branch is a pull request branch.
   447  	SourceBranch pulumi.StringPtrInput
   448  	// Describes the current stage for the branch. Valid values: `PRODUCTION`, `BETA`, `DEVELOPMENT`, `EXPERIMENTAL`, `PULL_REQUEST`.
   449  	Stage pulumi.StringPtrInput
   450  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   451  	Tags pulumi.StringMapInput
   452  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   453  	//
   454  	// Deprecated: Please use `tags` instead.
   455  	TagsAll pulumi.StringMapInput
   456  	// Content Time To Live (TTL) for the website in seconds.
   457  	Ttl pulumi.StringPtrInput
   458  }
   459  
   460  func (BranchState) ElementType() reflect.Type {
   461  	return reflect.TypeOf((*branchState)(nil)).Elem()
   462  }
   463  
   464  type branchArgs struct {
   465  	// Unique ID for an Amplify app.
   466  	AppId string `pulumi:"appId"`
   467  	// ARN for a backend environment that is part of an Amplify app.
   468  	BackendEnvironmentArn *string `pulumi:"backendEnvironmentArn"`
   469  	// Basic authorization credentials for the branch.
   470  	BasicAuthCredentials *string `pulumi:"basicAuthCredentials"`
   471  	// Name for the branch.
   472  	BranchName string `pulumi:"branchName"`
   473  	// Description for the branch.
   474  	Description *string `pulumi:"description"`
   475  	// Display name for a branch. This is used as the default domain prefix.
   476  	DisplayName *string `pulumi:"displayName"`
   477  	// Enables auto building for the branch.
   478  	EnableAutoBuild *bool `pulumi:"enableAutoBuild"`
   479  	// Enables basic authorization for the branch.
   480  	EnableBasicAuth *bool `pulumi:"enableBasicAuth"`
   481  	// Enables notifications for the branch.
   482  	EnableNotification *bool `pulumi:"enableNotification"`
   483  	// Enables performance mode for the branch.
   484  	EnablePerformanceMode *bool `pulumi:"enablePerformanceMode"`
   485  	// Enables pull request previews for this branch.
   486  	EnablePullRequestPreview *bool `pulumi:"enablePullRequestPreview"`
   487  	// Environment variables for the branch.
   488  	EnvironmentVariables map[string]string `pulumi:"environmentVariables"`
   489  	// Framework for the branch.
   490  	Framework *string `pulumi:"framework"`
   491  	// Amplify environment name for the pull request.
   492  	PullRequestEnvironmentName *string `pulumi:"pullRequestEnvironmentName"`
   493  	// Describes the current stage for the branch. Valid values: `PRODUCTION`, `BETA`, `DEVELOPMENT`, `EXPERIMENTAL`, `PULL_REQUEST`.
   494  	Stage *string `pulumi:"stage"`
   495  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   496  	Tags map[string]string `pulumi:"tags"`
   497  	// Content Time To Live (TTL) for the website in seconds.
   498  	Ttl *string `pulumi:"ttl"`
   499  }
   500  
   501  // The set of arguments for constructing a Branch resource.
   502  type BranchArgs struct {
   503  	// Unique ID for an Amplify app.
   504  	AppId pulumi.StringInput
   505  	// ARN for a backend environment that is part of an Amplify app.
   506  	BackendEnvironmentArn pulumi.StringPtrInput
   507  	// Basic authorization credentials for the branch.
   508  	BasicAuthCredentials pulumi.StringPtrInput
   509  	// Name for the branch.
   510  	BranchName pulumi.StringInput
   511  	// Description for the branch.
   512  	Description pulumi.StringPtrInput
   513  	// Display name for a branch. This is used as the default domain prefix.
   514  	DisplayName pulumi.StringPtrInput
   515  	// Enables auto building for the branch.
   516  	EnableAutoBuild pulumi.BoolPtrInput
   517  	// Enables basic authorization for the branch.
   518  	EnableBasicAuth pulumi.BoolPtrInput
   519  	// Enables notifications for the branch.
   520  	EnableNotification pulumi.BoolPtrInput
   521  	// Enables performance mode for the branch.
   522  	EnablePerformanceMode pulumi.BoolPtrInput
   523  	// Enables pull request previews for this branch.
   524  	EnablePullRequestPreview pulumi.BoolPtrInput
   525  	// Environment variables for the branch.
   526  	EnvironmentVariables pulumi.StringMapInput
   527  	// Framework for the branch.
   528  	Framework pulumi.StringPtrInput
   529  	// Amplify environment name for the pull request.
   530  	PullRequestEnvironmentName pulumi.StringPtrInput
   531  	// Describes the current stage for the branch. Valid values: `PRODUCTION`, `BETA`, `DEVELOPMENT`, `EXPERIMENTAL`, `PULL_REQUEST`.
   532  	Stage pulumi.StringPtrInput
   533  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   534  	Tags pulumi.StringMapInput
   535  	// Content Time To Live (TTL) for the website in seconds.
   536  	Ttl pulumi.StringPtrInput
   537  }
   538  
   539  func (BranchArgs) ElementType() reflect.Type {
   540  	return reflect.TypeOf((*branchArgs)(nil)).Elem()
   541  }
   542  
   543  type BranchInput interface {
   544  	pulumi.Input
   545  
   546  	ToBranchOutput() BranchOutput
   547  	ToBranchOutputWithContext(ctx context.Context) BranchOutput
   548  }
   549  
   550  func (*Branch) ElementType() reflect.Type {
   551  	return reflect.TypeOf((**Branch)(nil)).Elem()
   552  }
   553  
   554  func (i *Branch) ToBranchOutput() BranchOutput {
   555  	return i.ToBranchOutputWithContext(context.Background())
   556  }
   557  
   558  func (i *Branch) ToBranchOutputWithContext(ctx context.Context) BranchOutput {
   559  	return pulumi.ToOutputWithContext(ctx, i).(BranchOutput)
   560  }
   561  
   562  // BranchArrayInput is an input type that accepts BranchArray and BranchArrayOutput values.
   563  // You can construct a concrete instance of `BranchArrayInput` via:
   564  //
   565  //	BranchArray{ BranchArgs{...} }
   566  type BranchArrayInput interface {
   567  	pulumi.Input
   568  
   569  	ToBranchArrayOutput() BranchArrayOutput
   570  	ToBranchArrayOutputWithContext(context.Context) BranchArrayOutput
   571  }
   572  
   573  type BranchArray []BranchInput
   574  
   575  func (BranchArray) ElementType() reflect.Type {
   576  	return reflect.TypeOf((*[]*Branch)(nil)).Elem()
   577  }
   578  
   579  func (i BranchArray) ToBranchArrayOutput() BranchArrayOutput {
   580  	return i.ToBranchArrayOutputWithContext(context.Background())
   581  }
   582  
   583  func (i BranchArray) ToBranchArrayOutputWithContext(ctx context.Context) BranchArrayOutput {
   584  	return pulumi.ToOutputWithContext(ctx, i).(BranchArrayOutput)
   585  }
   586  
   587  // BranchMapInput is an input type that accepts BranchMap and BranchMapOutput values.
   588  // You can construct a concrete instance of `BranchMapInput` via:
   589  //
   590  //	BranchMap{ "key": BranchArgs{...} }
   591  type BranchMapInput interface {
   592  	pulumi.Input
   593  
   594  	ToBranchMapOutput() BranchMapOutput
   595  	ToBranchMapOutputWithContext(context.Context) BranchMapOutput
   596  }
   597  
   598  type BranchMap map[string]BranchInput
   599  
   600  func (BranchMap) ElementType() reflect.Type {
   601  	return reflect.TypeOf((*map[string]*Branch)(nil)).Elem()
   602  }
   603  
   604  func (i BranchMap) ToBranchMapOutput() BranchMapOutput {
   605  	return i.ToBranchMapOutputWithContext(context.Background())
   606  }
   607  
   608  func (i BranchMap) ToBranchMapOutputWithContext(ctx context.Context) BranchMapOutput {
   609  	return pulumi.ToOutputWithContext(ctx, i).(BranchMapOutput)
   610  }
   611  
   612  type BranchOutput struct{ *pulumi.OutputState }
   613  
   614  func (BranchOutput) ElementType() reflect.Type {
   615  	return reflect.TypeOf((**Branch)(nil)).Elem()
   616  }
   617  
   618  func (o BranchOutput) ToBranchOutput() BranchOutput {
   619  	return o
   620  }
   621  
   622  func (o BranchOutput) ToBranchOutputWithContext(ctx context.Context) BranchOutput {
   623  	return o
   624  }
   625  
   626  // Unique ID for an Amplify app.
   627  func (o BranchOutput) AppId() pulumi.StringOutput {
   628  	return o.ApplyT(func(v *Branch) pulumi.StringOutput { return v.AppId }).(pulumi.StringOutput)
   629  }
   630  
   631  // ARN for the branch.
   632  func (o BranchOutput) Arn() pulumi.StringOutput {
   633  	return o.ApplyT(func(v *Branch) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   634  }
   635  
   636  // A list of custom resources that are linked to this branch.
   637  func (o BranchOutput) AssociatedResources() pulumi.StringArrayOutput {
   638  	return o.ApplyT(func(v *Branch) pulumi.StringArrayOutput { return v.AssociatedResources }).(pulumi.StringArrayOutput)
   639  }
   640  
   641  // ARN for a backend environment that is part of an Amplify app.
   642  func (o BranchOutput) BackendEnvironmentArn() pulumi.StringPtrOutput {
   643  	return o.ApplyT(func(v *Branch) pulumi.StringPtrOutput { return v.BackendEnvironmentArn }).(pulumi.StringPtrOutput)
   644  }
   645  
   646  // Basic authorization credentials for the branch.
   647  func (o BranchOutput) BasicAuthCredentials() pulumi.StringPtrOutput {
   648  	return o.ApplyT(func(v *Branch) pulumi.StringPtrOutput { return v.BasicAuthCredentials }).(pulumi.StringPtrOutput)
   649  }
   650  
   651  // Name for the branch.
   652  func (o BranchOutput) BranchName() pulumi.StringOutput {
   653  	return o.ApplyT(func(v *Branch) pulumi.StringOutput { return v.BranchName }).(pulumi.StringOutput)
   654  }
   655  
   656  // Custom domains for the branch.
   657  func (o BranchOutput) CustomDomains() pulumi.StringArrayOutput {
   658  	return o.ApplyT(func(v *Branch) pulumi.StringArrayOutput { return v.CustomDomains }).(pulumi.StringArrayOutput)
   659  }
   660  
   661  // Description for the branch.
   662  func (o BranchOutput) Description() pulumi.StringPtrOutput {
   663  	return o.ApplyT(func(v *Branch) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   664  }
   665  
   666  // Destination branch if the branch is a pull request branch.
   667  func (o BranchOutput) DestinationBranch() pulumi.StringOutput {
   668  	return o.ApplyT(func(v *Branch) pulumi.StringOutput { return v.DestinationBranch }).(pulumi.StringOutput)
   669  }
   670  
   671  // Display name for a branch. This is used as the default domain prefix.
   672  func (o BranchOutput) DisplayName() pulumi.StringOutput {
   673  	return o.ApplyT(func(v *Branch) pulumi.StringOutput { return v.DisplayName }).(pulumi.StringOutput)
   674  }
   675  
   676  // Enables auto building for the branch.
   677  func (o BranchOutput) EnableAutoBuild() pulumi.BoolPtrOutput {
   678  	return o.ApplyT(func(v *Branch) pulumi.BoolPtrOutput { return v.EnableAutoBuild }).(pulumi.BoolPtrOutput)
   679  }
   680  
   681  // Enables basic authorization for the branch.
   682  func (o BranchOutput) EnableBasicAuth() pulumi.BoolPtrOutput {
   683  	return o.ApplyT(func(v *Branch) pulumi.BoolPtrOutput { return v.EnableBasicAuth }).(pulumi.BoolPtrOutput)
   684  }
   685  
   686  // Enables notifications for the branch.
   687  func (o BranchOutput) EnableNotification() pulumi.BoolPtrOutput {
   688  	return o.ApplyT(func(v *Branch) pulumi.BoolPtrOutput { return v.EnableNotification }).(pulumi.BoolPtrOutput)
   689  }
   690  
   691  // Enables performance mode for the branch.
   692  func (o BranchOutput) EnablePerformanceMode() pulumi.BoolPtrOutput {
   693  	return o.ApplyT(func(v *Branch) pulumi.BoolPtrOutput { return v.EnablePerformanceMode }).(pulumi.BoolPtrOutput)
   694  }
   695  
   696  // Enables pull request previews for this branch.
   697  func (o BranchOutput) EnablePullRequestPreview() pulumi.BoolPtrOutput {
   698  	return o.ApplyT(func(v *Branch) pulumi.BoolPtrOutput { return v.EnablePullRequestPreview }).(pulumi.BoolPtrOutput)
   699  }
   700  
   701  // Environment variables for the branch.
   702  func (o BranchOutput) EnvironmentVariables() pulumi.StringMapOutput {
   703  	return o.ApplyT(func(v *Branch) pulumi.StringMapOutput { return v.EnvironmentVariables }).(pulumi.StringMapOutput)
   704  }
   705  
   706  // Framework for the branch.
   707  func (o BranchOutput) Framework() pulumi.StringPtrOutput {
   708  	return o.ApplyT(func(v *Branch) pulumi.StringPtrOutput { return v.Framework }).(pulumi.StringPtrOutput)
   709  }
   710  
   711  // Amplify environment name for the pull request.
   712  func (o BranchOutput) PullRequestEnvironmentName() pulumi.StringPtrOutput {
   713  	return o.ApplyT(func(v *Branch) pulumi.StringPtrOutput { return v.PullRequestEnvironmentName }).(pulumi.StringPtrOutput)
   714  }
   715  
   716  // Source branch if the branch is a pull request branch.
   717  func (o BranchOutput) SourceBranch() pulumi.StringOutput {
   718  	return o.ApplyT(func(v *Branch) pulumi.StringOutput { return v.SourceBranch }).(pulumi.StringOutput)
   719  }
   720  
   721  // Describes the current stage for the branch. Valid values: `PRODUCTION`, `BETA`, `DEVELOPMENT`, `EXPERIMENTAL`, `PULL_REQUEST`.
   722  func (o BranchOutput) Stage() pulumi.StringPtrOutput {
   723  	return o.ApplyT(func(v *Branch) pulumi.StringPtrOutput { return v.Stage }).(pulumi.StringPtrOutput)
   724  }
   725  
   726  // Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   727  func (o BranchOutput) Tags() pulumi.StringMapOutput {
   728  	return o.ApplyT(func(v *Branch) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   729  }
   730  
   731  // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   732  //
   733  // Deprecated: Please use `tags` instead.
   734  func (o BranchOutput) TagsAll() pulumi.StringMapOutput {
   735  	return o.ApplyT(func(v *Branch) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   736  }
   737  
   738  // Content Time To Live (TTL) for the website in seconds.
   739  func (o BranchOutput) Ttl() pulumi.StringPtrOutput {
   740  	return o.ApplyT(func(v *Branch) pulumi.StringPtrOutput { return v.Ttl }).(pulumi.StringPtrOutput)
   741  }
   742  
   743  type BranchArrayOutput struct{ *pulumi.OutputState }
   744  
   745  func (BranchArrayOutput) ElementType() reflect.Type {
   746  	return reflect.TypeOf((*[]*Branch)(nil)).Elem()
   747  }
   748  
   749  func (o BranchArrayOutput) ToBranchArrayOutput() BranchArrayOutput {
   750  	return o
   751  }
   752  
   753  func (o BranchArrayOutput) ToBranchArrayOutputWithContext(ctx context.Context) BranchArrayOutput {
   754  	return o
   755  }
   756  
   757  func (o BranchArrayOutput) Index(i pulumi.IntInput) BranchOutput {
   758  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Branch {
   759  		return vs[0].([]*Branch)[vs[1].(int)]
   760  	}).(BranchOutput)
   761  }
   762  
   763  type BranchMapOutput struct{ *pulumi.OutputState }
   764  
   765  func (BranchMapOutput) ElementType() reflect.Type {
   766  	return reflect.TypeOf((*map[string]*Branch)(nil)).Elem()
   767  }
   768  
   769  func (o BranchMapOutput) ToBranchMapOutput() BranchMapOutput {
   770  	return o
   771  }
   772  
   773  func (o BranchMapOutput) ToBranchMapOutputWithContext(ctx context.Context) BranchMapOutput {
   774  	return o
   775  }
   776  
   777  func (o BranchMapOutput) MapIndex(k pulumi.StringInput) BranchOutput {
   778  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Branch {
   779  		return vs[0].(map[string]*Branch)[vs[1].(string)]
   780  	}).(BranchOutput)
   781  }
   782  
   783  func init() {
   784  	pulumi.RegisterInputType(reflect.TypeOf((*BranchInput)(nil)).Elem(), &Branch{})
   785  	pulumi.RegisterInputType(reflect.TypeOf((*BranchArrayInput)(nil)).Elem(), BranchArray{})
   786  	pulumi.RegisterInputType(reflect.TypeOf((*BranchMapInput)(nil)).Elem(), BranchMap{})
   787  	pulumi.RegisterOutputType(BranchOutput{})
   788  	pulumi.RegisterOutputType(BranchArrayOutput{})
   789  	pulumi.RegisterOutputType(BranchMapOutput{})
   790  }