Skip to content

Latest commit

 

History

History
724 lines (541 loc) · 53.3 KB

File metadata and controls

724 lines (541 loc) · 53.3 KB

Security

Overview

Available Operations

updateAttackChallengeMode

Update the setting for determining if the project has Attack Challenge mode enabled.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.security.updateAttackChallengeMode({
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      projectId: "<id>",
      attackModeEnabled: false,
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { securityUpdateAttackChallengeMode } from "@vercel/sdk/funcs/securityUpdateAttackChallengeMode.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await securityUpdateAttackChallengeMode(vercel, {
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      projectId: "<id>",
      attackModeEnabled: false,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("securityUpdateAttackChallengeMode failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.UpdateAttackChallengeModeRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.UpdateAttackChallengeModeResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

putFirewallConfig

Set the firewall configuration to provided rules and settings. Creates or overwrite the existing firewall configuration.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.security.putFirewallConfig({
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      firewallEnabled: true,
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { securityPutFirewallConfig } from "@vercel/sdk/funcs/securityPutFirewallConfig.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await securityPutFirewallConfig(vercel, {
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      firewallEnabled: true,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("securityPutFirewallConfig failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.PutFirewallConfigRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.PutFirewallConfigResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

updateFirewallConfig

Process updates to modify the existing firewall config for a project

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.security.updateFirewallConfig({
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      action: "ip.remove",
      id: "<id>",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { securityUpdateFirewallConfig } from "@vercel/sdk/funcs/securityUpdateFirewallConfig.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await securityUpdateFirewallConfig(vercel, {
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      action: "ip.remove",
      id: "<id>",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("securityUpdateFirewallConfig failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.UpdateFirewallConfigRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.UpdateFirewallConfigResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

getFirewallConfig

Retrieve the specified firewall configuration for a project. The deployed configVersion will be active

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.security.getFirewallConfig({
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    configVersion: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { securityGetFirewallConfig } from "@vercel/sdk/funcs/securityGetFirewallConfig.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await securityGetFirewallConfig(vercel, {
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    configVersion: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("securityGetFirewallConfig failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetFirewallConfigRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetFirewallConfigResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

getActiveAttackStatus

Retrieve active attack data within the last N days (default: 1 day)

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.security.getActiveAttackStatus({
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { securityGetActiveAttackStatus } from "@vercel/sdk/funcs/securityGetActiveAttackStatus.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await securityGetActiveAttackStatus(vercel, {
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("securityGetActiveAttackStatus failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetActiveAttackStatusRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetActiveAttackStatusResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

getBypassIp

Retrieve the system bypass rules configured for the specified project

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.security.getBypassIp({
    projectId: "<id>",
    limit: 10,
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { securityGetBypassIp } from "@vercel/sdk/funcs/securityGetBypassIp.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await securityGetBypassIp(vercel, {
    projectId: "<id>",
    limit: 10,
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("securityGetBypassIp failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetBypassIpRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetBypassIpResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

addBypassIp

Create new system bypass rules

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.security.addBypassIp({
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { securityAddBypassIp } from "@vercel/sdk/funcs/securityAddBypassIp.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await securityAddBypassIp(vercel, {
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("securityAddBypassIp failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.AddBypassIpRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.AddBypassIpResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

removeBypassIp

Remove system bypass rules

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.security.removeBypassIp({
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { securityRemoveBypassIp } from "@vercel/sdk/funcs/securityRemoveBypassIp.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await securityRemoveBypassIp(vercel, {
    projectId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("securityRemoveBypassIp failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.RemoveBypassIpRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.RemoveBypassIpResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

getSecurityFirewallEvents

Retrieve firewall actions for a project

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel();

async function run() {
  const result = await vercel.security.getSecurityFirewallEvents({
    projectId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { securityGetSecurityFirewallEvents } from "@vercel/sdk/funcs/securityGetSecurityFirewallEvents.js";

// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore();

async function run() {
  const res = await securityGetSecurityFirewallEvents(vercel, {
    projectId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("securityGetSecurityFirewallEvents failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetSecurityFirewallEventsRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetSecurityFirewallEventsResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*