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

export interface IngressArgs extends core.SchemaArgs {
  cidrBlocks?: core.Array<string> | core.ArrayOut<core.StringOut>;

  description?: string | core.StringOut;

  fromPort: number | core.NumberOut;

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

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

  protocol: string | core.StringOut;

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

  self?: boolean | core.BooleanOut;

  toPort: number | core.NumberOut;
}

export class Ingress extends core.Schema<IngressArgs> {
  @core.attr(String, { kind: "array" })
  public cidrBlocks?: core.Array<string> | core.ArrayOut<core.StringOut>;

  @core.attr(String)
  public description?: string | core.StringOut;

  @core.attr(Number)
  public fromPort!: number | core.NumberOut;

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

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

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

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

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

  @core.attr(Number)
  public toPort!: number | core.NumberOut;
}

export interface EgressArgs extends core.SchemaArgs {
  cidrBlocks?: core.Array<string> | core.ArrayOut<core.StringOut>;

  description?: string | core.StringOut;

  fromPort: number | core.NumberOut;

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

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

  protocol: string | core.StringOut;

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

  self?: boolean | core.BooleanOut;

  toPort: number | core.NumberOut;
}

export class Egress extends core.Schema<EgressArgs> {
  @core.attr(String, { kind: "array" })
  public cidrBlocks?: core.Array<string> | core.ArrayOut<core.StringOut>;

  @core.attr(String)
  public description?: string | core.StringOut;

  @core.attr(Number)
  public fromPort!: number | core.NumberOut;

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

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

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

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

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

  @core.attr(Number)
  public toPort!: number | core.NumberOut;
}

export interface SecurityGroupArgs extends core.ResourceArgs {
  description?: string | core.StringOut;

  egress?: core.Array<Egress> | core.ArrayOut<Egress>;

  ingress?: core.Array<Ingress> | core.ArrayOut<Ingress>;

  name?: string | core.StringOut;

  namePrefix?: string | core.StringOut;

  revokeRulesOnDelete?: boolean | core.BooleanOut;

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

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

  vpcId?: string | core.StringOut;
}

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

  @core.attr(String)
  public description?: string | core.StringOut;

  @core.attr(Egress, { computed: true, kind: "array" })
  public egress?: core.Array<Egress> | core.ArrayOut<Egress>;

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

  @core.attr(Ingress, { computed: true, kind: "array" })
  public ingress?: core.Array<Ingress> | core.ArrayOut<Ingress>;

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

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

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

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

  @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 vpcId?: string | core.StringOut;

  constructor(name: string, args?: SecurityGroupArgs) {
    super(name, "aws_security_group", args);
  }

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