async authorizeOne(ip, permission) {
    switch (permission.provider) {
      case "aws-sg":
        const awssg = new AwsSecurityGroup(permission.region);
        let ingress;
        try {
          ingress = await awssg.addIngress(ip, permission);
          if ((ingress.status === AwsSecurityGroup.STATUS_ADDED) || (ingress.status === AwsSecurityGroup.STATUS_ALREADY_DEFINED_ID)) {
            await this.storage.add(ingress.id, { ip: ip, permission: permission, timestamp: Date.now() });
          }
        } catch (error) {
          console.log(error);
          ingress = { status: AwsSecurityGroup.STATUS_ERROR, error: error };
        }

        const prefix = permission.provider + " " + permission.securitygroup + "(" + permission.region + "): Port " + permission.port;
        const expires = new Duration(permission.ttl).expires().calendar();
        switch (ingress.status) {
          case AwsSecurityGroup.STATUS_ADDED:
            return prefix + " opened to current IP. Expires: " + expires + " (UTC)";
          case AwsSecurityGroup.STATUS_ALREADY_DEFINED_ID:
            return prefix + " already opened to current IP. Updated expiry to: " + expires + " (UTC)";
          case AwsSecurityGroup.STATUS_ALREADY_DEFINED_OTHER:
            return prefix + " already opened to current IP by permanent ingress authorization!";
          case AwsSecurityGroup.STATUS_ERROR:
            return prefix + ": Error opening port to current IP. " + ingress.error;
          default:
            return prefix + ": Error opening port to current IP. See logs.";
        }
      default:
        return "Unsupported provider";
    }
  }
/**
   * Authorize single permission to given IP.
   * 
   * @returns {string} Change to show on page.
   */
Authorize single permission to given IP.

@returns {string} Change to show on page.
Authorize single permission to given IP . @returns { string } Change to show on page .
async authorizeOne(ip, permission) {
    switch (permission.provider) {
      case "aws-sg":
        const awssg = new AwsSecurityGroup(permission.region);
        let ingress;
        try {
          ingress = await awssg.addIngress(ip, permission);
          if ((ingress.status === AwsSecurityGroup.STATUS_ADDED) || (ingress.status === AwsSecurityGroup.STATUS_ALREADY_DEFINED_ID)) {
            await this.storage.add(ingress.id, { ip: ip, permission: permission, timestamp: Date.now() });
          }
        } catch (error) {
          console.log(error);
          ingress = { status: AwsSecurityGroup.STATUS_ERROR, error: error };
        }
        const prefix = permission.provider + " " + permission.securitygroup + "(" + permission.region + "): Port " + permission.port;
        const expires = new Duration(permission.ttl).expires().calendar();
        switch (ingress.status) {
          case AwsSecurityGroup.STATUS_ADDED:
            return prefix + " opened to current IP. Expires: " + expires + " (UTC)";
          case AwsSecurityGroup.STATUS_ALREADY_DEFINED_ID:
            return prefix + " already opened to current IP. Updated expiry to: " + expires + " (UTC)";
          case AwsSecurityGroup.STATUS_ALREADY_DEFINED_OTHER:
            return prefix + " already opened to current IP by permanent ingress authorization!";
          case AwsSecurityGroup.STATUS_ERROR:
            return prefix + ": Error opening port to current IP. " + ingress.error;
          default:
            return prefix + ": Error opening port to current IP. See logs.";
        }
      default:
        return "Unsupported provider";
    }
  }
async authorizeOne ( ip , permission ) { switch ( permission . provider ) { case "aws-sg" : const awssg = new AwsSecurityGroup ( permission . region ) ; let ingress ; try { ingress = await awssg . addIngress ( ip , permission ) ; if ( ( ingress . status === AwsSecurityGroup . STATUS_ADDED ) || ( ingress . status === AwsSecurityGroup . STATUS_ALREADY_DEFINED_ID ) ) { await this . storage . add ( ingress . id , { ip : ip , permission : permission , timestamp : Date . now ( ) } ) ; } } catch ( error ) { console . log ( error ) ; ingress = { status : AwsSecurityGroup . STATUS_ERROR , error : error } ; } const prefix = permission . provider + " " + permission . securitygroup + "(" + permission . region + "): Port " + permission . port ; const expires = new Duration ( permission . ttl ) . expires ( ) . calendar ( ) ; switch ( ingress . status ) { case AwsSecurityGroup . STATUS_ADDED : return prefix + " opened to current IP. Expires: " + expires + " (UTC)" ; case AwsSecurityGroup . STATUS_ALREADY_DEFINED_ID : return prefix + " already opened to current IP. Updated expiry to: " + expires + " (UTC)" ; case AwsSecurityGroup . STATUS_ALREADY_DEFINED_OTHER : return prefix + " already opened to current IP by permanent ingress authorization!" ; case AwsSecurityGroup . STATUS_ERROR : return prefix + ": Error opening port to current IP. " + ingress . error ; default : return prefix + ": Error opening port to current IP. See logs." ; } default : return "Unsupported provider" ; } }
Authorize single permission to given IP.
Authorize single permission to given IP .