package awscdkamplifyalpha

import (
	_init_ "github.com/aws/aws-cdk-go/awscdkamplifyalpha/v2/jsii"
	_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)

// Custom rewrite/redirect rule for an Amplify App.
//
// Example:
//   import "github.com/aws/aws-cdk-go/awscdkamplifyalpha"
//
//   var amplifyApp app
//
//   amplifyApp.AddCustomRule(awscdkamplifyalpha.NewCustomRule(&CustomRuleOptions{
//   	Source: jsii.String("/docs/specific-filename.html"),
//   	Target: jsii.String("/documents/different-filename.html"),
//   	Status: amplify.RedirectStatus_TEMPORARY_REDIRECT,
//   }))
//
// See: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html
//
// Experimental.
type CustomRule interface {
	// The condition for a URL rewrite or redirect rule, e.g. country code.
	// See: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html
	//
	// Default: - no condition.
	//
	// Experimental.
	Condition() *string
	// The source pattern for a URL rewrite or redirect rule.
	// See: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html
	//
	// Experimental.
	Source() *string
	// The status code for a URL rewrite or redirect rule.
	// See: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html
	//
	// Default: PERMANENT_REDIRECT.
	//
	// Experimental.
	Status() RedirectStatus
	// The target pattern for a URL rewrite or redirect rule.
	// See: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html
	//
	// Experimental.
	Target() *string
}

// The jsii proxy struct for CustomRule
type jsiiProxy_CustomRule struct {
	_ byte // padding
}

func (j *jsiiProxy_CustomRule) Condition() *string {
	var returns *string
	_jsii_.Get(
		j,
		"condition",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_CustomRule) Source() *string {
	var returns *string
	_jsii_.Get(
		j,
		"source",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_CustomRule) Status() RedirectStatus {
	var returns RedirectStatus
	_jsii_.Get(
		j,
		"status",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_CustomRule) Target() *string {
	var returns *string
	_jsii_.Get(
		j,
		"target",
		&returns,
	)
	return returns
}


// Experimental.
func NewCustomRule(options *CustomRuleOptions) CustomRule {
	_init_.Initialize()

	if err := validateNewCustomRuleParameters(options); err != nil {
		panic(err)
	}
	j := jsiiProxy_CustomRule{}

	_jsii_.Create(
		"@aws-cdk/aws-amplify-alpha.CustomRule",
		[]interface{}{options},
		&j,
	)

	return &j
}

// Experimental.
func NewCustomRule_Override(c CustomRule, options *CustomRuleOptions) {
	_init_.Initialize()

	_jsii_.Create(
		"@aws-cdk/aws-amplify-alpha.CustomRule",
		[]interface{}{options},
		c,
	)
}

func CustomRule_SINGLE_PAGE_APPLICATION_REDIRECT() CustomRule {
	_init_.Initialize()
	var returns CustomRule
	_jsii_.StaticGet(
		"@aws-cdk/aws-amplify-alpha.CustomRule",
		"SINGLE_PAGE_APPLICATION_REDIRECT",
		&returns,
	)
	return returns
}

