import * as core from "@terrascript/core";

export interface ProviderArgs extends core.SchemaArgs {
  keyArn: string | core.StringOut;
}

export class Provider extends core.Schema<ProviderArgs> {
  @core.attr(String)
  public keyArn!: string | core.StringOut;
}

export interface EncryptionConfigArgs extends core.SchemaArgs {
  provider: Provider;

  resources: core.Array<string> | core.ArrayOut<core.StringOut>;
}

export class EncryptionConfig extends core.Schema<EncryptionConfigArgs> {
  @core.attr(Provider)
  public provider!: Provider;

  @core.attr(String, { kind: "array" })
  public resources!: core.Array<string> | core.ArrayOut<core.StringOut>;
}

export interface CertificateAuthorityArgs extends core.SchemaArgs {
  data: string | core.StringOut;
}

export class CertificateAuthority extends core.Schema<CertificateAuthorityArgs> {
  @core.attr(String, { computed: true })
  public data!: string | core.StringOut;
}

export interface OidcArgs extends core.SchemaArgs {
  issuer: string | core.StringOut;
}

export class Oidc extends core.Schema<OidcArgs> {
  @core.attr(String, { computed: true })
  public issuer!: string | core.StringOut;
}

export interface IdentityArgs extends core.SchemaArgs {
  oidc: core.Array<Oidc> | core.ArrayOut<Oidc>;
}

export class Identity extends core.Schema<IdentityArgs> {
  @core.attr(Oidc, { computed: true, kind: "array" })
  public oidc!: core.Array<Oidc> | core.ArrayOut<Oidc>;
}

export interface KubernetesNetworkConfigArgs extends core.SchemaArgs {
  ipFamily?: string | core.StringOut;

  serviceIpv4Cidr?: string | core.StringOut;
}

export class KubernetesNetworkConfig extends core.Schema<KubernetesNetworkConfigArgs> {
  @core.attr(String, { computed: true })
  public ipFamily?: string | core.StringOut;

  @core.attr(String, { computed: true })
  public serviceIpv4Cidr?: string | core.StringOut;
}

export interface VpcConfigArgs extends core.SchemaArgs {
  clusterSecurityGroupId: string | core.StringOut;

  endpointPrivateAccess?: boolean | core.BooleanOut;

  endpointPublicAccess?: boolean | core.BooleanOut;

  publicAccessCidrs?: core.Array<string> | core.ArrayOut<core.StringOut>;

  securityGroupIds?: core.Array<string> | core.ArrayOut<core.StringOut>;

  subnetIds: core.Array<string> | core.ArrayOut<core.StringOut>;

  vpcId: string | core.StringOut;
}

export class VpcConfig extends core.Schema<VpcConfigArgs> {
  @core.attr(String, { computed: true })
  public clusterSecurityGroupId!: string | core.StringOut;

  @core.attr(Boolean)
  public endpointPrivateAccess?: boolean | core.BooleanOut;

  @core.attr(Boolean)
  public endpointPublicAccess?: boolean | core.BooleanOut;

  @core.attr(String, { computed: true, kind: "array" })
  public publicAccessCidrs?: core.Array<string> | core.ArrayOut<core.StringOut>;

  @core.attr(String, { kind: "array" })
  public securityGroupIds?: core.Array<string> | core.ArrayOut<core.StringOut>;

  @core.attr(String, { kind: "array" })
  public subnetIds!: core.Array<string> | core.ArrayOut<core.StringOut>;

  @core.attr(String, { computed: true })
  public vpcId!: string | core.StringOut;
}

export interface ClusterArgs extends core.ResourceArgs {
  enabledClusterLogTypes?: core.Array<string> | core.ArrayOut<core.StringOut>;

  encryptionConfig?: EncryptionConfig;

  kubernetesNetworkConfig?: KubernetesNetworkConfig;

  name: string | core.StringOut;

  roleArn: string | core.StringOut;

  tags?: core.Map<string, string> | core.MapOut<core.StringOut>;

  tagsAll?: core.Map<string, string> | core.MapOut<core.StringOut>;

  version?: string | core.StringOut;

  vpcConfig: VpcConfig;
}

export class Cluster extends core.Resource<ClusterArgs> {
  @core.attr(String, { computed: true })
  public arn!: string | core.StringOut;

  @core.attr(CertificateAuthority, { computed: true, kind: "array" })
  public certificateAuthority!:
    | core.Array<CertificateAuthority>
    | core.ArrayOut<CertificateAuthority>;

  @core.attr(String, { computed: true })
  public createdAt!: string | core.StringOut;

  @core.attr(String, { kind: "array" })
  public enabledClusterLogTypes?:
    | core.Array<string>
    | core.ArrayOut<core.StringOut>;

  @core.attr(EncryptionConfig)
  public encryptionConfig?: EncryptionConfig;

  @core.attr(String, { computed: true })
  public endpoint!: string | core.StringOut;

  @core.attr(String, { computed: true })
  public id!: string | core.StringOut;

  @core.attr(Identity, { computed: true, kind: "array" })
  public identity!: core.Array<Identity> | core.ArrayOut<Identity>;

  @core.attr(KubernetesNetworkConfig, { computed: true })
  public kubernetesNetworkConfig?: KubernetesNetworkConfig;

  @core.attr(String)
  public name!: string | core.StringOut;

  @core.attr(String, { computed: true })
  public platformVersion!: string | core.StringOut;

  @core.attr(String)
  public roleArn!: string | core.StringOut;

  @core.attr(String, { computed: true })
  public status!: string | core.StringOut;

  @core.attr(String, { kind: "map" })
  public tags?: core.Map<string, string> | core.MapOut<core.StringOut>;

  @core.attr(String, { computed: true, kind: "map" })
  public tagsAll?: core.Map<string, string> | core.MapOut<core.StringOut>;

  @core.attr(String, { computed: true })
  public version?: string | core.StringOut;

  @core.attr(VpcConfig)
  public vpcConfig!: VpcConfig;

  constructor(name: string, args?: ClusterArgs) {
    super(name, "aws_eks_cluster", args);
  }

  public override getNamespace(): string {
    return "aws_eks";
  }
}
