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

export interface SecurityGroupRuleArgs extends core.ResourceArgs {
  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;

  securityGroupId: string | core.StringOut;

  self?: boolean | core.BooleanOut;

  sourceSecurityGroupId?: string | core.StringOut;

  toPort: number | core.NumberOut;

  type: string | core.StringOut;
}

export class SecurityGroupRule extends core.Resource<SecurityGroupRuleArgs> {
  @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, { computed: true })
  public id!: string | core.StringOut;

  @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)
  public securityGroupId!: string | core.StringOut;

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

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

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

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

  constructor(name: string, args?: SecurityGroupRuleArgs) {
    super(name, "aws_security_group_rule", args);
  }

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