package awscloudtrail

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/awscloudtrail/internal"
	"github.com/aws/aws-cdk-go/awscdk/v2/awsevents"
	"github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
	"github.com/aws/aws-cdk-go/awscdk/v2/awslogs"
	"github.com/aws/constructs-go/constructs/v10"
)

// Cloud trail allows you to log events that happen in your AWS account For example:.
//
// import { CloudTrail } from 'aws-cdk-lib/aws-cloudtrail'
//
// const cloudTrail = new CloudTrail(this, 'MyTrail');.
//
// Example:
//   import cloudtrail "github.com/aws/aws-cdk-go/awscdk"
//
//
//   myKeyAlias := kms.Alias_FromAliasName(this, jsii.String("myKey"), jsii.String("alias/aws/s3"))
//   trail := cloudtrail.NewTrail(this, jsii.String("myCloudTrail"), &TrailProps{
//   	SendToCloudWatchLogs: jsii.Boolean(true),
//   	EncryptionKey: myKeyAlias,
//   })
//
type Trail interface {
	awscdk.Resource
	// 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 CloudWatch log group to which CloudTrail events are sent.
	//
	// `undefined` if `sendToCloudWatchLogs` property is false.
	LogGroup() awslogs.ILogGroup
	// 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
	// ARN of the CloudTrail trail i.e. arn:aws:cloudtrail:us-east-2:123456789012:trail/myCloudTrail.
	TrailArn() *string
	// ARN of the Amazon SNS topic that's associated with the CloudTrail trail, i.e. arn:aws:sns:us-east-2:123456789012:mySNSTopic.
	TrailSnsTopicArn() *string
	// When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.
	//
	// Only events that match your trail settings are delivered to your Amazon S3 bucket and Amazon CloudWatch Logs log group.
	//
	// This method adds an Event Selector for filtering events that match either S3 or Lambda function operations.
	//
	// Data events: These events provide insight into the resource operations performed on or within a resource.
	// These are also known as data plane operations.
	AddEventSelector(dataResourceType DataResourceType, dataResourceValues *[]*string, options *AddEventSelectorOptions)
	// When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.
	//
	// Only events that match your trail settings are delivered to your Amazon S3 bucket and Amazon CloudWatch Logs log group.
	//
	// This method adds a Lambda Data Event Selector for filtering events that match Lambda function operations.
	//
	// Data events: These events provide insight into the resource operations performed on or within a resource.
	// These are also known as data plane operations.
	AddLambdaEventSelector(handlers *[]awslambda.IFunction, options *AddEventSelectorOptions)
	// When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.
	//
	// Only events that match your trail settings are delivered to your Amazon S3 bucket and Amazon CloudWatch Logs log group.
	//
	// This method adds an S3 Data Event Selector for filtering events that match S3 operations.
	//
	// Data events: These events provide insight into the resource operations performed on or within a resource.
	// These are also known as data plane operations.
	AddS3EventSelector(s3Selector *[]*S3EventSelector, options *AddEventSelectorOptions)
	// 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)
	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
	// Log all Lambda data events for all lambda functions the account.
	// See: https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html
	//
	// Default: false.
	//
	LogAllLambdaDataEvents(options *AddEventSelectorOptions)
	// Log all S3 data events for all objects for all buckets in the account.
	// See: https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html
	//
	// Default: false.
	//
	LogAllS3DataEvents(options *AddEventSelectorOptions)
	// Returns a string representation of this construct.
	ToString() *string
}

// The jsii proxy struct for Trail
type jsiiProxy_Trail struct {
	internal.Type__awscdkResource
}

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

func (j *jsiiProxy_Trail) LogGroup() awslogs.ILogGroup {
	var returns awslogs.ILogGroup
	_jsii_.Get(
		j,
		"logGroup",
		&returns,
	)
	return returns
}

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

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

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

func (j *jsiiProxy_Trail) TrailArn() *string {
	var returns *string
	_jsii_.Get(
		j,
		"trailArn",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Trail) TrailSnsTopicArn() *string {
	var returns *string
	_jsii_.Get(
		j,
		"trailSnsTopicArn",
		&returns,
	)
	return returns
}


func NewTrail(scope constructs.Construct, id *string, props *TrailProps) Trail {
	_init_.Initialize()

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

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

	return &j
}

func NewTrail_Override(t Trail, scope constructs.Construct, id *string, props *TrailProps) {
	_init_.Initialize()

	_jsii_.Create(
		"aws-cdk-lib.aws_cloudtrail.Trail",
		[]interface{}{scope, id, props},
		t,
	)
}

// 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 Trail_IsConstruct(x interface{}) *bool {
	_init_.Initialize()

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

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

	return returns
}

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

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

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

	return returns
}

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

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

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

	return returns
}

// Create an event rule for when an event is recorded by any Trail in the account.
//
// Note that the event doesn't necessarily have to come from this Trail, it can
// be captured from any one.
//
// Be sure to filter the event further down using an event pattern.
func Trail_OnEvent(scope constructs.Construct, id *string, options *awsevents.OnEventOptions) awsevents.Rule {
	_init_.Initialize()

	if err := validateTrail_OnEventParameters(scope, id, options); err != nil {
		panic(err)
	}
	var returns awsevents.Rule

	_jsii_.StaticInvoke(
		"aws-cdk-lib.aws_cloudtrail.Trail",
		"onEvent",
		[]interface{}{scope, id, options},
		&returns,
	)

	return returns
}

func Trail_PROPERTY_INJECTION_ID() *string {
	_init_.Initialize()
	var returns *string
	_jsii_.StaticGet(
		"aws-cdk-lib.aws_cloudtrail.Trail",
		"PROPERTY_INJECTION_ID",
		&returns,
	)
	return returns
}

func (t *jsiiProxy_Trail) AddEventSelector(dataResourceType DataResourceType, dataResourceValues *[]*string, options *AddEventSelectorOptions) {
	if err := t.validateAddEventSelectorParameters(dataResourceType, dataResourceValues, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		t,
		"addEventSelector",
		[]interface{}{dataResourceType, dataResourceValues, options},
	)
}

func (t *jsiiProxy_Trail) AddLambdaEventSelector(handlers *[]awslambda.IFunction, options *AddEventSelectorOptions) {
	if err := t.validateAddLambdaEventSelectorParameters(handlers, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		t,
		"addLambdaEventSelector",
		[]interface{}{handlers, options},
	)
}

func (t *jsiiProxy_Trail) AddS3EventSelector(s3Selector *[]*S3EventSelector, options *AddEventSelectorOptions) {
	if err := t.validateAddS3EventSelectorParameters(s3Selector, options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		t,
		"addS3EventSelector",
		[]interface{}{s3Selector, options},
	)
}

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

func (t *jsiiProxy_Trail) GeneratePhysicalName() *string {
	var returns *string

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

	return returns
}

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

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

	return returns
}

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

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

	return returns
}

func (t *jsiiProxy_Trail) LogAllLambdaDataEvents(options *AddEventSelectorOptions) {
	if err := t.validateLogAllLambdaDataEventsParameters(options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		t,
		"logAllLambdaDataEvents",
		[]interface{}{options},
	)
}

func (t *jsiiProxy_Trail) LogAllS3DataEvents(options *AddEventSelectorOptions) {
	if err := t.validateLogAllS3DataEventsParameters(options); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		t,
		"logAllS3DataEvents",
		[]interface{}{options},
	)
}

func (t *jsiiProxy_Trail) ToString() *string {
	var returns *string

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

	return returns
}

