package awsappconfig

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

	"github.com/aws/aws-cdk-go/awscdk/v2"
	"github.com/aws/aws-cdk-go/awscdk/v2/awsappconfig/internal"
	"github.com/aws/aws-cdk-go/awscdk/v2/awsecs"
	"github.com/aws/constructs-go/constructs/v10"
)

// An AWS AppConfig application.
//
// Example:
//   app := appconfig.NewApplication(this, jsii.String("MyApp"))
//   env := appconfig.NewEnvironment(this, jsii.String("MyEnv"), &EnvironmentProps{
//   	Application: app,
//   })
//
//   appconfig.NewHostedConfiguration(this, jsii.String("MyHostedConfig"), &HostedConfigurationProps{
//   	Application: app,
//   	DeployTo: []iEnvironment{
//   		env,
//   	},
//   	Content: appconfig.ConfigurationContent_FromInlineText(jsii.String("This is my configuration content.")),
//   })
//
// See: https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-application.html
//
type Application interface {
	awscdk.Resource
	IApplication
	IExtensible
	// The Amazon Resource Name (ARN) of the application.
	ApplicationArn() *string
	// The ID of the application.
	ApplicationId() *string
	// The description of the application.
	Description() *string
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	Env() *awscdk.ResourceEnvironment
	Extensible() ExtensibleBase
	SetExtensible(val ExtensibleBase)
	// The name of the application.
	Name() *string
	// The tree node.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//   cross-environment scenarios.
	PhysicalName() *string
	// The stack in which this resource is defined.
	Stack() awscdk.Stack
	// Adds an environment.
	AddEnvironment(id *string, options *EnvironmentOptions) IEnvironment
	// Adds an existing environment.
	AddExistingEnvironment(environment IEnvironment)
	// Adds an extension association to the application.
	AddExtension(extension IExtension)
	// Adds a hosted configuration.
	AddHostedConfiguration(id *string, options *HostedConfigurationOptions) HostedConfiguration
	// Adds a sourced configuration.
	AddSourcedConfiguration(id *string, options *SourcedConfigurationOptions) SourcedConfiguration
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and also creates an extension association to an application.
	AtDeploymentTick(eventDestination IEventDestination, options *ExtensionOptions)
	// Returns the list of associated environments.
	Environments() *[]IEnvironment
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	GetResourceNameAttribute(nameAttr *string) *string
	// Adds an extension defined by the action point and event destination and also creates an extension association to an application.
	On(actionPoint ActionPoint, eventDestination IEventDestination, options *ExtensionOptions)
	// Adds an ON_DEPLOYMENT_BAKING extension with the provided event destination and also creates an extension association to an application.
	OnDeploymentBaking(eventDestination IEventDestination, options *ExtensionOptions)
	// Adds an ON_DEPLOYMENT_COMPLETE extension with the provided event destination and also creates an extension association to an application.
	OnDeploymentComplete(eventDestination IEventDestination, options *ExtensionOptions)
	// Adds an ON_DEPLOYMENT_ROLLED_BACK extension with the provided event destination and also creates an extension association to an application.
	OnDeploymentRolledBack(eventDestination IEventDestination, options *ExtensionOptions)
	// Adds an ON_DEPLOYMENT_START extension with the provided event destination and also creates an extension association to an application.
	OnDeploymentStart(eventDestination IEventDestination, options *ExtensionOptions)
	// Adds an ON_DEPLOYMENT_STEP extension with the provided event destination and also creates an extension association to an application.
	OnDeploymentStep(eventDestination IEventDestination, options *ExtensionOptions)
	// Adds a PRE_CREATE_HOSTED_CONFIGURATION_VERSION extension with the provided event destination and also creates an extension association to an application.
	PreCreateHostedConfigurationVersion(eventDestination IEventDestination, options *ExtensionOptions)
	// Adds a PRE_START_DEPLOYMENT extension with the provided event destination and also creates an extension association to an application.
	PreStartDeployment(eventDestination IEventDestination, options *ExtensionOptions)
	// Returns a string representation of this construct.
	ToString() *string
}

// The jsii proxy struct for Application
type jsiiProxy_Application struct {
	internal.Type__awscdkResource
	jsiiProxy_IApplication
	jsiiProxy_IExtensible
}

func (j *jsiiProxy_Application) ApplicationArn() *string {
	var returns *string
	_jsii_.Get(
		j,
		"applicationArn",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Application) ApplicationId() *string {
	var returns *string
	_jsii_.Get(
		j,
		"applicationId",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Application) Description() *string {
	var returns *string
	_jsii_.Get(
		j,
		"description",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Application) Env() *awscdk.ResourceEnvironment {
	var returns *awscdk.ResourceEnvironment
	_jsii_.Get(
		j,
		"env",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Application) Extensible() ExtensibleBase {
	var returns ExtensibleBase
	_jsii_.Get(
		j,
		"extensible",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Application) Name() *string {
	var returns *string
	_jsii_.Get(
		j,
		"name",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Application) Node() constructs.Node {
	var returns constructs.Node
	_jsii_.Get(
		j,
		"node",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Application) PhysicalName() *string {
	var returns *string
	_jsii_.Get(
		j,
		"physicalName",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Application) Stack() awscdk.Stack {
	var returns awscdk.Stack
	_jsii_.Get(
		j,
		"stack",
		&returns,
	)
	return returns
}


func NewApplication(scope constructs.Construct, id *string, props *ApplicationProps) Application {
	_init_.Initialize()

	if err := validateNewApplicationParameters(scope, id, props); err != nil {
		panic(err)
	}
	j := jsiiProxy_Application{}

	_jsii_.Create(
		"aws-cdk-lib.aws_appconfig.Application",
		[]interface{}{scope, id, props},
		&j,
	)

	return &j
}

func NewApplication_Override(a Application, scope constructs.Construct, id *string, props *ApplicationProps) {
	_init_.Initialize()

	_jsii_.Create(
		"aws-cdk-lib.aws_appconfig.Application",
		[]interface{}{scope, id, props},
		a,
	)
}

func (j *jsiiProxy_Application)SetExtensible(val ExtensibleBase) {
	if err := j.validateSetExtensibleParameters(val); err != nil {
		panic(err)
	}
	_jsii_.Set(
		j,
		"extensible",
		val,
	)
}

// Adds the AWS AppConfig Agent as a container to the provided ECS task definition.
func Application_AddAgentToEcs(taskDef awsecs.TaskDefinition) {
	_init_.Initialize()

	if err := validateApplication_AddAgentToEcsParameters(taskDef); err != nil {
		panic(err)
	}
	_jsii_.StaticInvokeVoid(
		"aws-cdk-lib.aws_appconfig.Application",
		"addAgentToEcs",
		[]interface{}{taskDef},
	)
}

// Imports an AWS AppConfig application into the CDK using its Amazon Resource Name (ARN).
func Application_FromApplicationArn(scope constructs.Construct, id *string, applicationArn *string) IApplication {
	_init_.Initialize()

	if err := validateApplication_FromApplicationArnParameters(scope, id, applicationArn); err != nil {
		panic(err)
	}
	var returns IApplication

	_jsii_.StaticInvoke(
		"aws-cdk-lib.aws_appconfig.Application",
		"fromApplicationArn",
		[]interface{}{scope, id, applicationArn},
		&returns,
	)

	return returns
}

// Imports an AWS AppConfig application into the CDK using its ID.
func Application_FromApplicationId(scope constructs.Construct, id *string, applicationId *string) IApplication {
	_init_.Initialize()

	if err := validateApplication_FromApplicationIdParameters(scope, id, applicationId); err != nil {
		panic(err)
	}
	var returns IApplication

	_jsii_.StaticInvoke(
		"aws-cdk-lib.aws_appconfig.Application",
		"fromApplicationId",
		[]interface{}{scope, id, applicationId},
		&returns,
	)

	return returns
}

// Retrieves the Lambda layer version Amazon Resource Name (ARN) for the AWS AppConfig Lambda extension.
//
// Returns: Lambda layer version ARN.
func Application_GetLambdaLayerVersionArn(region *string, platform Platform) *string {
	_init_.Initialize()

	if err := validateApplication_GetLambdaLayerVersionArnParameters(region); err != nil {
		panic(err)
	}
	var returns *string

	_jsii_.StaticInvoke(
		"aws-cdk-lib.aws_appconfig.Application",
		"getLambdaLayerVersionArn",
		[]interface{}{region, platform},
		&returns,
	)

	return returns
}

// Checks if `x` is a construct.
//
// Use this method instead of `instanceof` to properly detect `Construct`
// instances, even when the construct library is symlinked.
//
// Explanation: in JavaScript, multiple copies of the `constructs` library on
// disk are seen as independent, completely different libraries. As a
// consequence, the class `Construct` in each copy of the `constructs` library
// is seen as a different class, and an instance of one class will not test as
// `instanceof` the other class. `npm install` will not create installations
// like this, but users may manually symlink construct libraries together or
// use a monorepo tool: in those cases, multiple copies of the `constructs`
// library can be accidentally installed, and `instanceof` will behave
// unpredictably. It is safest to avoid using `instanceof`, and using
// this type-testing method instead.
//
// Returns: true if `x` is an object created from a class which extends `Construct`.
func Application_IsConstruct(x interface{}) *bool {
	_init_.Initialize()

	if err := validateApplication_IsConstructParameters(x); err != nil {
		panic(err)
	}
	var returns *bool

	_jsii_.StaticInvoke(
		"aws-cdk-lib.aws_appconfig.Application",
		"isConstruct",
		[]interface{}{x},
		&returns,
	)

	return returns
}

// Returns true if the construct was created by CDK, and false otherwise.
func Application_IsOwnedResource(construct constructs.IConstruct) *bool {
	_init_.Initialize()

	if err := validateApplication_IsOwnedResourceParameters(construct); err != nil {
		panic(err)
	}
	var returns *bool

	_jsii_.StaticInvoke(
		"aws-cdk-lib.aws_appconfig.Application",
		"isOwnedResource",
		[]interface{}{construct},
		&returns,
	)

	return returns
}

// Check whether the given construct is a Resource.
func Application_IsResource(construct constructs.IConstruct) *bool {
	_init_.Initialize()

	if err := validateApplication_IsResourceParameters(construct); err != nil {
		panic(err)
	}
	var returns *bool

	_jsii_.StaticInvoke(
		"aws-cdk-lib.aws_appconfig.Application",
		"isResource",
		[]interface{}{construct},
		&returns,
	)

	return returns
}

func Application_PROPERTY_INJECTION_ID() *string {
	_init_.Initialize()
	var returns *string
	_jsii_.StaticGet(
		"aws-cdk-lib.aws_appconfig.Application",
		"PROPERTY_INJECTION_ID",
		&returns,
	)
	return returns
}

func (a *jsiiProxy_Application) AddEnvironment(id *string, options *EnvironmentOptions) IEnvironment {
	if err := a.validateAddEnvironmentParameters(id, options); err != nil {
		panic(err)
	}
	var returns IEnvironment

	_jsii_.Invoke(
		a,
		"addEnvironment",
		[]interface{}{id, options},
		&returns,
	)

	return returns
}

func (a *jsiiProxy_Application) AddExistingEnvironment(environment IEnvironment) {
	if err := a.validateAddExistingEnvironmentParameters(environment); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"addExistingEnvironment",
		[]interface{}{environment},
	)
}

func (a *jsiiProxy_Application) AddExtension(extension IExtension) {
	if err := a.validateAddExtensionParameters(extension); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"addExtension",
		[]interface{}{extension},
	)
}

func (a *jsiiProxy_Application) AddHostedConfiguration(id *string, options *HostedConfigurationOptions) HostedConfiguration {
	if err := a.validateAddHostedConfigurationParameters(id, options); err != nil {
		panic(err)
	}
	var returns HostedConfiguration

	_jsii_.Invoke(
		a,
		"addHostedConfiguration",
		[]interface{}{id, options},
		&returns,
	)

	return returns
}

func (a *jsiiProxy_Application) AddSourcedConfiguration(id *string, options *SourcedConfigurationOptions) SourcedConfiguration {
	if err := a.validateAddSourcedConfigurationParameters(id, options); err != nil {
		panic(err)
	}
	var returns SourcedConfiguration

	_jsii_.Invoke(
		a,
		"addSourcedConfiguration",
		[]interface{}{id, options},
		&returns,
	)

	return returns
}

func (a *jsiiProxy_Application) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {
	if err := a.validateApplyRemovalPolicyParameters(policy); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"applyRemovalPolicy",
		[]interface{}{policy},
	)
}

func (a *jsiiProxy_Application) AtDeploymentTick(eventDestination IEventDestination, options *ExtensionOptions) {
	if err := a.validateAtDeploymentTickParameters(eventDestination, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"atDeploymentTick",
		[]interface{}{eventDestination, options},
	)
}

func (a *jsiiProxy_Application) Environments() *[]IEnvironment {
	var returns *[]IEnvironment

	_jsii_.Invoke(
		a,
		"environments",
		nil, // no parameters
		&returns,
	)

	return returns
}

func (a *jsiiProxy_Application) GeneratePhysicalName() *string {
	var returns *string

	_jsii_.Invoke(
		a,
		"generatePhysicalName",
		nil, // no parameters
		&returns,
	)

	return returns
}

func (a *jsiiProxy_Application) GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string {
	if err := a.validateGetResourceArnAttributeParameters(arnAttr, arnComponents); err != nil {
		panic(err)
	}
	var returns *string

	_jsii_.Invoke(
		a,
		"getResourceArnAttribute",
		[]interface{}{arnAttr, arnComponents},
		&returns,
	)

	return returns
}

func (a *jsiiProxy_Application) GetResourceNameAttribute(nameAttr *string) *string {
	if err := a.validateGetResourceNameAttributeParameters(nameAttr); err != nil {
		panic(err)
	}
	var returns *string

	_jsii_.Invoke(
		a,
		"getResourceNameAttribute",
		[]interface{}{nameAttr},
		&returns,
	)

	return returns
}

func (a *jsiiProxy_Application) On(actionPoint ActionPoint, eventDestination IEventDestination, options *ExtensionOptions) {
	if err := a.validateOnParameters(actionPoint, eventDestination, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"on",
		[]interface{}{actionPoint, eventDestination, options},
	)
}

func (a *jsiiProxy_Application) OnDeploymentBaking(eventDestination IEventDestination, options *ExtensionOptions) {
	if err := a.validateOnDeploymentBakingParameters(eventDestination, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"onDeploymentBaking",
		[]interface{}{eventDestination, options},
	)
}

func (a *jsiiProxy_Application) OnDeploymentComplete(eventDestination IEventDestination, options *ExtensionOptions) {
	if err := a.validateOnDeploymentCompleteParameters(eventDestination, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"onDeploymentComplete",
		[]interface{}{eventDestination, options},
	)
}

func (a *jsiiProxy_Application) OnDeploymentRolledBack(eventDestination IEventDestination, options *ExtensionOptions) {
	if err := a.validateOnDeploymentRolledBackParameters(eventDestination, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"onDeploymentRolledBack",
		[]interface{}{eventDestination, options},
	)
}

func (a *jsiiProxy_Application) OnDeploymentStart(eventDestination IEventDestination, options *ExtensionOptions) {
	if err := a.validateOnDeploymentStartParameters(eventDestination, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"onDeploymentStart",
		[]interface{}{eventDestination, options},
	)
}

func (a *jsiiProxy_Application) OnDeploymentStep(eventDestination IEventDestination, options *ExtensionOptions) {
	if err := a.validateOnDeploymentStepParameters(eventDestination, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"onDeploymentStep",
		[]interface{}{eventDestination, options},
	)
}

func (a *jsiiProxy_Application) PreCreateHostedConfigurationVersion(eventDestination IEventDestination, options *ExtensionOptions) {
	if err := a.validatePreCreateHostedConfigurationVersionParameters(eventDestination, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"preCreateHostedConfigurationVersion",
		[]interface{}{eventDestination, options},
	)
}

func (a *jsiiProxy_Application) PreStartDeployment(eventDestination IEventDestination, options *ExtensionOptions) {
	if err := a.validatePreStartDeploymentParameters(eventDestination, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		a,
		"preStartDeployment",
		[]interface{}{eventDestination, options},
	)
}

func (a *jsiiProxy_Application) ToString() *string {
	var returns *string

	_jsii_.Invoke(
		a,
		"toString",
		nil, // no parameters
		&returns,
	)

	return returns
}

