package awscdkgluealpha

import (
	_init_ "github.com/aws/aws-cdk-go/awscdkgluealpha/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/awsglue"
	"github.com/aws/aws-cdk-go/awscdk/v2/awsiam"
	"github.com/aws/aws-cdk-go/awscdk/v2/awskms"
	"github.com/aws/aws-cdk-go/awscdk/v2/awss3"
	"github.com/aws/constructs-go/constructs/v10"
)

// A Glue table.
//
// Example:
//   var glueDatabase iDatabase
//
//   table := glue.NewTable(this, jsii.String("Table"), &S3TableProps{
//   	StorageParameters: []storageParameter{
//   		glue.*storageParameter_SkipHeaderLineCount(jsii.Number(1)),
//   		glue.*storageParameter_CompressionType(glue.CompressionType_GZIP),
//   		glue.*storageParameter_Custom(jsii.String("foo"), jsii.String("bar")),
//   		glue.*storageParameter_*Custom(jsii.String("separatorChar"), jsii.String(",")),
//   		glue.*storageParameter_*Custom(glue.StorageParameters_WRITE_PARALLEL, jsii.String("off")),
//   	},
//   	// ...
//   	Database: glueDatabase,
//   	Columns: []column{
//   		&column{
//   			Name: jsii.String("col1"),
//   			Type: glue.Schema_STRING(),
//   		},
//   	},
//   	DataFormat: glue.DataFormat_CSV(),
//   })
//
// Deprecated: Use {@link S3Table } instead.
type Table interface {
	S3Table
	// S3 bucket in which the table's data resides.
	// Deprecated: Use {@link S3Table } instead.
	Bucket() awss3.IBucket
	// This table's columns.
	// Deprecated: Use {@link S3Table } instead.
	Columns() *[]*Column
	// Indicates whether the table's data is compressed or not.
	// Deprecated: Use {@link S3Table } instead.
	Compressed() *bool
	// Database this table belongs to.
	// Deprecated: Use {@link S3Table } instead.
	Database() IDatabase
	// Format of this table's data files.
	// Deprecated: Use {@link S3Table } instead.
	DataFormat() DataFormat
	// The type of encryption enabled for the table.
	// Deprecated: Use {@link S3Table } instead.
	Encryption() TableEncryption
	// The KMS key used to secure the data if `encryption` is set to `CSE-KMS` or `SSE-KMS`.
	//
	// Otherwise, `undefined`.
	// Deprecated: Use {@link S3Table } instead.
	EncryptionKey() awskms.IKey
	// 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.
	// Deprecated: Use {@link S3Table } instead.
	Env() *awscdk.ResourceEnvironment
	// The tree node.
	// Deprecated: Use {@link S3Table } instead.
	Node() constructs.Node
	// The tables' properties associated with the table.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-parameters
	//
	// Deprecated: Use {@link S3Table } instead.
	Parameters() *map[string]*string
	// This table's partition indexes.
	// Deprecated: Use {@link S3Table } instead.
	PartitionIndexes() *[]*PartitionIndex
	// This table's partition keys if the table is partitioned.
	// Deprecated: Use {@link S3Table } instead.
	PartitionKeys() *[]*Column
	// 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.
	// Deprecated: Use {@link S3Table } instead.
	PhysicalName() *string
	// S3 Key Prefix under which this table's files are stored in S3.
	// Deprecated: Use {@link S3Table } instead.
	S3Prefix() *string
	// The stack in which this resource is defined.
	// Deprecated: Use {@link S3Table } instead.
	Stack() awscdk.Stack
	// The tables' storage descriptor properties.
	// Deprecated: Use {@link S3Table } instead.
	StorageParameters() *[]StorageParameter
	// ARN of this table.
	// Deprecated: Use {@link S3Table } instead.
	TableArn() *string
	// Name of this table.
	// Deprecated: Use {@link S3Table } instead.
	TableName() *string
	// Deprecated: Use {@link S3Table } instead.
	TableResource() awsglue.CfnTable
	// Add a partition index to the table.
	//
	// You can have a maximum of 3 partition
	// indexes to a table. Partition index keys must be a subset of the table's
	// partition keys.
	// See: https://docs.aws.amazon.com/glue/latest/dg/partition-indexes.html
	//
	// Deprecated: Use {@link S3Table } instead.
	AddPartitionIndex(index *PartitionIndex)
	// 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`).
	// Deprecated: Use {@link S3Table } instead.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Deprecated: Use {@link S3Table } instead.
	GeneratePhysicalName() *string
	// Deprecated: Use {@link S3Table } instead.
	GenerateS3PrefixForGrant() *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`.
	// Deprecated: Use {@link S3Table } instead.
	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.
	// Deprecated: Use {@link S3Table } instead.
	GetResourceNameAttribute(nameAttr *string) *string
	// Grant the given identity custom permissions.
	// Deprecated: Use {@link S3Table } instead.
	Grant(grantee awsiam.IGrantable, actions *[]*string) awsiam.Grant
	// Grant read permissions to the table and the underlying data stored in S3 to an IAM principal.
	// Deprecated: Use {@link S3Table } instead.
	GrantRead(grantee awsiam.IGrantable) awsiam.Grant
	// Grant read and write permissions to the table and the underlying data stored in S3 to an IAM principal.
	// Deprecated: Use {@link S3Table } instead.
	GrantReadWrite(grantee awsiam.IGrantable) awsiam.Grant
	// Grant the given identity custom permissions to ALL underlying resources of the table.
	//
	// Permissions will be granted to the catalog, the database, and the table.
	// Deprecated: Use {@link S3Table } instead.
	GrantToUnderlyingResources(grantee awsiam.IGrantable, actions *[]*string) awsiam.Grant
	// Grant write permissions to the table and the underlying data stored in S3 to an IAM principal.
	// Deprecated: Use {@link S3Table } instead.
	GrantWrite(grantee awsiam.IGrantable) awsiam.Grant
	// Returns a string representation of this construct.
	// Deprecated: Use {@link S3Table } instead.
	ToString() *string
}

// The jsii proxy struct for Table
type jsiiProxy_Table struct {
	jsiiProxy_S3Table
}

func (j *jsiiProxy_Table) Bucket() awss3.IBucket {
	var returns awss3.IBucket
	_jsii_.Get(
		j,
		"bucket",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Table) Columns() *[]*Column {
	var returns *[]*Column
	_jsii_.Get(
		j,
		"columns",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Table) Compressed() *bool {
	var returns *bool
	_jsii_.Get(
		j,
		"compressed",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Table) Database() IDatabase {
	var returns IDatabase
	_jsii_.Get(
		j,
		"database",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Table) DataFormat() DataFormat {
	var returns DataFormat
	_jsii_.Get(
		j,
		"dataFormat",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Table) Encryption() TableEncryption {
	var returns TableEncryption
	_jsii_.Get(
		j,
		"encryption",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Table) EncryptionKey() awskms.IKey {
	var returns awskms.IKey
	_jsii_.Get(
		j,
		"encryptionKey",
		&returns,
	)
	return returns
}

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

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

func (j *jsiiProxy_Table) Parameters() *map[string]*string {
	var returns *map[string]*string
	_jsii_.Get(
		j,
		"parameters",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Table) PartitionIndexes() *[]*PartitionIndex {
	var returns *[]*PartitionIndex
	_jsii_.Get(
		j,
		"partitionIndexes",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Table) PartitionKeys() *[]*Column {
	var returns *[]*Column
	_jsii_.Get(
		j,
		"partitionKeys",
		&returns,
	)
	return returns
}

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

func (j *jsiiProxy_Table) S3Prefix() *string {
	var returns *string
	_jsii_.Get(
		j,
		"s3Prefix",
		&returns,
	)
	return returns
}

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

func (j *jsiiProxy_Table) StorageParameters() *[]StorageParameter {
	var returns *[]StorageParameter
	_jsii_.Get(
		j,
		"storageParameters",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Table) TableArn() *string {
	var returns *string
	_jsii_.Get(
		j,
		"tableArn",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Table) TableName() *string {
	var returns *string
	_jsii_.Get(
		j,
		"tableName",
		&returns,
	)
	return returns
}

func (j *jsiiProxy_Table) TableResource() awsglue.CfnTable {
	var returns awsglue.CfnTable
	_jsii_.Get(
		j,
		"tableResource",
		&returns,
	)
	return returns
}


// Deprecated: Use {@link S3Table } instead.
func NewTable(scope constructs.Construct, id *string, props *S3TableProps) Table {
	_init_.Initialize()

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

	_jsii_.Create(
		"@aws-cdk/aws-glue-alpha.Table",
		[]interface{}{scope, id, props},
		&j,
	)

	return &j
}

// Deprecated: Use {@link S3Table } instead.
func NewTable_Override(t Table, scope constructs.Construct, id *string, props *S3TableProps) {
	_init_.Initialize()

	_jsii_.Create(
		"@aws-cdk/aws-glue-alpha.Table",
		[]interface{}{scope, id, props},
		t,
	)
}

// Deprecated: Use {@link S3Table } instead.
func Table_FromTableArn(scope constructs.Construct, id *string, tableArn *string) ITable {
	_init_.Initialize()

	if err := validateTable_FromTableArnParameters(scope, id, tableArn); err != nil {
		panic(err)
	}
	var returns ITable

	_jsii_.StaticInvoke(
		"@aws-cdk/aws-glue-alpha.Table",
		"fromTableArn",
		[]interface{}{scope, id, tableArn},
		&returns,
	)

	return returns
}

// Creates a Table construct that represents an external table.
// Deprecated: Use {@link S3Table } instead.
func Table_FromTableAttributes(scope constructs.Construct, id *string, attrs *TableAttributes) ITable {
	_init_.Initialize()

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

	_jsii_.StaticInvoke(
		"@aws-cdk/aws-glue-alpha.Table",
		"fromTableAttributes",
		[]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`.
// Deprecated: Use {@link S3Table } instead.
func Table_IsConstruct(x interface{}) *bool {
	_init_.Initialize()

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

	_jsii_.StaticInvoke(
		"@aws-cdk/aws-glue-alpha.Table",
		"isConstruct",
		[]interface{}{x},
		&returns,
	)

	return returns
}

// Returns true if the construct was created by CDK, and false otherwise.
// Deprecated: Use {@link S3Table } instead.
func Table_IsOwnedResource(construct constructs.IConstruct) *bool {
	_init_.Initialize()

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

	_jsii_.StaticInvoke(
		"@aws-cdk/aws-glue-alpha.Table",
		"isOwnedResource",
		[]interface{}{construct},
		&returns,
	)

	return returns
}

// Check whether the given construct is a Resource.
// Deprecated: Use {@link S3Table } instead.
func Table_IsResource(construct constructs.IConstruct) *bool {
	_init_.Initialize()

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

	_jsii_.StaticInvoke(
		"@aws-cdk/aws-glue-alpha.Table",
		"isResource",
		[]interface{}{construct},
		&returns,
	)

	return returns
}

func Table_PROPERTY_INJECTION_ID() *string {
	_init_.Initialize()
	var returns *string
	_jsii_.StaticGet(
		"@aws-cdk/aws-glue-alpha.Table",
		"PROPERTY_INJECTION_ID",
		&returns,
	)
	return returns
}

func (t *jsiiProxy_Table) AddPartitionIndex(index *PartitionIndex) {
	if err := t.validateAddPartitionIndexParameters(index); err != nil {
		panic(err)
	}
	_jsii_.InvokeVoid(
		t,
		"addPartitionIndex",
		[]interface{}{index},
	)
}

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

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

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

	return returns
}

func (t *jsiiProxy_Table) GenerateS3PrefixForGrant() *string {
	var returns *string

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

	return returns
}

func (t *jsiiProxy_Table) 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_Table) 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_Table) Grant(grantee awsiam.IGrantable, actions *[]*string) awsiam.Grant {
	if err := t.validateGrantParameters(grantee, actions); err != nil {
		panic(err)
	}
	var returns awsiam.Grant

	_jsii_.Invoke(
		t,
		"grant",
		[]interface{}{grantee, actions},
		&returns,
	)

	return returns
}

func (t *jsiiProxy_Table) GrantRead(grantee awsiam.IGrantable) awsiam.Grant {
	if err := t.validateGrantReadParameters(grantee); err != nil {
		panic(err)
	}
	var returns awsiam.Grant

	_jsii_.Invoke(
		t,
		"grantRead",
		[]interface{}{grantee},
		&returns,
	)

	return returns
}

func (t *jsiiProxy_Table) GrantReadWrite(grantee awsiam.IGrantable) awsiam.Grant {
	if err := t.validateGrantReadWriteParameters(grantee); err != nil {
		panic(err)
	}
	var returns awsiam.Grant

	_jsii_.Invoke(
		t,
		"grantReadWrite",
		[]interface{}{grantee},
		&returns,
	)

	return returns
}

func (t *jsiiProxy_Table) GrantToUnderlyingResources(grantee awsiam.IGrantable, actions *[]*string) awsiam.Grant {
	if err := t.validateGrantToUnderlyingResourcesParameters(grantee, actions); err != nil {
		panic(err)
	}
	var returns awsiam.Grant

	_jsii_.Invoke(
		t,
		"grantToUnderlyingResources",
		[]interface{}{grantee, actions},
		&returns,
	)

	return returns
}

func (t *jsiiProxy_Table) GrantWrite(grantee awsiam.IGrantable) awsiam.Grant {
	if err := t.validateGrantWriteParameters(grantee); err != nil {
		panic(err)
	}
	var returns awsiam.Grant

	_jsii_.Invoke(
		t,
		"grantWrite",
		[]interface{}{grantee},
		&returns,
	)

	return returns
}

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

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

	return returns
}

