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/awsiam"
	"github.com/aws/constructs-go/constructs/v10"
)

// An AWS AppConfig environment.
//
// Example:
//   app := appconfig.NewApplication(this, jsii.String("MyApp"))
//   env := appconfig.NewEnvironment(this, jsii.String("MyEnv"), &EnvironmentProps{
//   	Application: app,
//   })
//
//   appconfig.NewHostedConfiguration(this, jsii.String("MyFirstHostedConfig"), &HostedConfigurationProps{
//   	Application: app,
//   	DeployTo: []iEnvironment{
//   		env,
//   	},
//   	Content: appconfig.ConfigurationContent_FromInlineText(jsii.String("This is my first configuration content.")),
//   })
//
//   appconfig.NewHostedConfiguration(this, jsii.String("MySecondHostedConfig"), &HostedConfigurationProps{
//   	Application: app,
//   	DeployTo: []*iEnvironment{
//   		env,
//   	},
//   	Content: appconfig.ConfigurationContent_*FromInlineText(jsii.String("This is my second configuration content.")),
//   })
//
// See: https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-environment.html
//
type Environment interface {
	awscdk.Resource
	IEnvironment
	IExtensible
	// The application associated with the environment.
	Application() IApplication
	// The ID of the environment.
	ApplicationId() *string
	DeploymentQueue() *[]CfnDeployment
	SetDeploymentQueue(val *[]CfnDeployment)
	// The description of the environment.
	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
	// The Amazon Resource Name (ARN) of the environment.
	EnvironmentArn() *string
	// The ID of the environment.
	EnvironmentId() *string
	Extensible() ExtensibleBase
	SetExtensible(val ExtensibleBase)
	// The monitors for the environment.
	Monitors() *[]Monitor
	// The name of the environment.
	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
	// Creates a deployment of the supplied configuration to this environment.
	//
	// Note that you can only deploy one configuration at a time to an environment.
	// However, you can deploy one configuration each to different environments at the same time.
	// If more than one deployment is requested for this environment, they will occur in the same order they were provided.
	AddDeployment(configuration IConfiguration)
	// Creates a deployment for each of the supplied configurations to this environment.
	//
	// These configurations will be deployed in the same order as the input array.
	AddDeployments(configurations ...IConfiguration)
	// Adds an extension association to the environment.
	AddExtension(extension IExtension)
	// 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)
	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 IAM policy statement associated with this environment to an IAM principal's policy.
	Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant
	// Permits an IAM principal to perform read operations on this environment's configurations.
	//
	// Actions: GetLatestConfiguration, StartConfigurationSession.
	GrantReadConfig(identity awsiam.IGrantable) awsiam.Grant
	// Adds an extension defined by the action point and event destination and also creates an extension association to the environment.
	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 the environment.
	OnDeploymentBaking(eventDestination IEventDestination, options *ExtensionOptions)
	// Adds an ON_DEPLOYMENT_COMPLETE extension with the provided event destination and also creates an extension association to the environment.
	OnDeploymentComplete(eventDestination IEventDestination, options *ExtensionOptions)
	// Adds an ON_DEPLOYMENT_ROLLED_BACK extension with the provided event destination and also creates an extension association to the environment.
	OnDeploymentRolledBack(eventDestination IEventDestination, options *ExtensionOptions)
	// Adds an ON_DEPLOYMENT_START extension with the provided event destination and also creates an extension association to the environment.
	OnDeploymentStart(eventDestination IEventDestination, options *ExtensionOptions)
	// Adds an ON_DEPLOYMENT_STEP extension with the provided event destination and also creates an extension association to the environment.
	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 the environment.
	PreCreateHostedConfigurationVersion(eventDestination IEventDestination, options *ExtensionOptions)
	// Adds a PRE_START_DEPLOYMENT extension with the provided event destination and also creates an extension association to the environment.
	PreStartDeployment(eventDestination IEventDestination, options *ExtensionOptions)
	// Returns a string representation of this construct.
	ToString() *string
}

// The jsii proxy struct for Environment
type jsiiProxy_Environment struct {
	internal.Type__awscdkResource
	jsiiProxy_IEnvironment
	jsiiProxy_IExtensible
}

func (j *jsiiProxy_Environment) Application() IApplication {
	var returns IApplication
	_jsii_.Get(
		j,
		"application",
		&returns,
	)
	return returns
}

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

func (j *jsiiProxy_Environment) DeploymentQueue() *[]CfnDeployment {
	var returns *[]CfnDeployment
	_jsii_.Get(
		j,
		"deploymentQueue",
		&returns,
	)
	return returns
}

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

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

func (j *jsiiProxy_Environment) EnvironmentArn() *string {
	var returns *string
	_jsii_.Get(
		j,
		"environmentArn",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Environment) EnvironmentId() *string {
	var returns *string
	_jsii_.Get(
		j,
		"environmentId",
		&returns,
	)
	return returns
}

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

func (j *jsiiProxy_Environment) Monitors() *[]Monitor {
	var returns *[]Monitor
	_jsii_.Get(
		j,
		"monitors",
		&returns,
	)
	return returns
}

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

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

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

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


func NewEnvironment(scope constructs.Construct, id *string, props *EnvironmentProps) Environment {
	_init_.Initialize()

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

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

	return &j
}

func NewEnvironment_Override(e Environment, scope constructs.Construct, id *string, props *EnvironmentProps) {
	_init_.Initialize()

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

func (j *jsiiProxy_Environment)SetDeploymentQueue(val *[]CfnDeployment) {
	if err := j.validateSetDeploymentQueueParameters(val); err != nil {
		panic(err)
	}
	_jsii_.Set(
		j,
		"deploymentQueue",
		val,
	)
}

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

// Imports an environment into the CDK using its Amazon Resource Name (ARN).
func Environment_FromEnvironmentArn(scope constructs.Construct, id *string, environmentArn *string) IEnvironment {
	_init_.Initialize()

	if err := validateEnvironment_FromEnvironmentArnParameters(scope, id, environmentArn); err != nil {
		panic(err)
	}
	var returns IEnvironment

	_jsii_.StaticInvoke(
		"aws-cdk-lib.aws_appconfig.Environment",
		"fromEnvironmentArn",
		[]interface{}{scope, id, environmentArn},
		&returns,
	)

	return returns
}

// Imports an environment into the CDK from its attributes.
func Environment_FromEnvironmentAttributes(scope constructs.Construct, id *string, attrs *EnvironmentAttributes) IEnvironment {
	_init_.Initialize()

	if err := validateEnvironment_FromEnvironmentAttributesParameters(scope, id, attrs); err != nil {
		panic(err)
	}
	var returns IEnvironment

	_jsii_.StaticInvoke(
		"aws-cdk-lib.aws_appconfig.Environment",
		"fromEnvironmentAttributes",
		[]interface{}{scope, id, attrs},
		&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 Environment_IsConstruct(x interface{}) *bool {
	_init_.Initialize()

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

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

	return returns
}

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

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

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

	return returns
}

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

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

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

	return returns
}

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

func (e *jsiiProxy_Environment) AddDeployment(configuration IConfiguration) {
	if err := e.validateAddDeploymentParameters(configuration); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		e,
		"addDeployment",
		[]interface{}{configuration},
	)
}

func (e *jsiiProxy_Environment) AddDeployments(configurations ...IConfiguration) {
	args := []interface{}{}
	for _, a := range configurations {
		args = append(args, a)
	}

	_jsii_.InvokeVoid(
		e,
		"addDeployments",
		args,
	)
}

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

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

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

func (e *jsiiProxy_Environment) GeneratePhysicalName() *string {
	var returns *string

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

	return returns
}

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

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

	return returns
}

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

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

	return returns
}

func (e *jsiiProxy_Environment) Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant {
	if err := e.validateGrantParameters(grantee); err != nil {
		panic(err)
	}
	args := []interface{}{grantee}
	for _, a := range actions {
		args = append(args, a)
	}

	var returns awsiam.Grant

	_jsii_.Invoke(
		e,
		"grant",
		args,
		&returns,
	)

	return returns
}

func (e *jsiiProxy_Environment) GrantReadConfig(identity awsiam.IGrantable) awsiam.Grant {
	if err := e.validateGrantReadConfigParameters(identity); err != nil {
		panic(err)
	}
	var returns awsiam.Grant

	_jsii_.Invoke(
		e,
		"grantReadConfig",
		[]interface{}{identity},
		&returns,
	)

	return returns
}

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

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

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

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

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

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

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

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

func (e *jsiiProxy_Environment) ToString() *string {
	var returns *string

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

	return returns
}

