Skip to content

Latest commit

 

History

History
912 lines (687 loc) · 66.7 KB

README.md

File metadata and controls

912 lines (687 loc) · 66.7 KB

Networking

Overview

Available Operations

listNetworks

Allows to list Secure Compute networks.

Example Usage

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

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

async function run() {
  const result = await vercel.networking.listNetworks({
    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 { networkingListNetworks } from "@vercel/sdk/funcs/networkingListNetworks.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 networkingListNetworks(vercel, {
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("networkingListNetworks failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.ListNetworksRequest ✔️ 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.Network[]>

Errors

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

createNetwork

Allows to create a Secure Compute network.

Example Usage

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

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

async function run() {
  const result = await vercel.networking.createNetwork({
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      awsAvailabilityZoneIds: [
        "use1-az1",
      ],
      cidr: "192.168.0.0/16",
      name: "<value>",
      region: "iad1",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { networkingCreateNetwork } from "@vercel/sdk/funcs/networkingCreateNetwork.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 networkingCreateNetwork(vercel, {
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      awsAvailabilityZoneIds: [
        "use1-az1",
      ],
      cidr: "192.168.0.0/16",
      name: "<value>",
      region: "iad1",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("networkingCreateNetwork failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.CreateNetworkRequest ✔️ 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.Network>

Errors

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

deleteNetwork

Allows to delete a Secure Compute network.

Example Usage

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

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

async function run() {
  await vercel.networking.deleteNetwork({
    networkId: "uzrmorq7bn05z-fz",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });


}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { networkingDeleteNetwork } from "@vercel/sdk/funcs/networkingDeleteNetwork.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 networkingDeleteNetwork(vercel, {
    networkId: "uzrmorq7bn05z-fz",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    
  } else {
    console.log("networkingDeleteNetwork failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.DeleteNetworkRequest ✔️ 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<void>

Errors

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

updateNetwork

Allows to update a Secure Compute network.

Example Usage

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

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

async function run() {
  const result = await vercel.networking.updateNetwork({
    networkId: "uzrmorq7bn05z-fz",
    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 { networkingUpdateNetwork } from "@vercel/sdk/funcs/networkingUpdateNetwork.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 networkingUpdateNetwork(vercel, {
    networkId: "uzrmorq7bn05z-fz",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("networkingUpdateNetwork failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.UpdateNetworkRequest ✔️ 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.Network>

Errors

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

readNetwork

Allows to read a Secure Compute network.

Example Usage

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

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

async function run() {
  const result = await vercel.networking.readNetwork({
    networkId: "uzrmorq7bn05z-fz",
    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 { networkingReadNetwork } from "@vercel/sdk/funcs/networkingReadNetwork.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 networkingReadNetwork(vercel, {
    networkId: "uzrmorq7bn05z-fz",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("networkingReadNetwork failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.ReadNetworkRequest ✔️ 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.Network>

Errors

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

createPrivateLinkEndpoint

Creates a PrivateLink endpoint for a project. Changes to endpoints of the same project are serialized. If another change holds them for too long, the request fails with 503 service_unavailable and can be retried. If the change may have completed but the outcome is unknown, it fails with 409 uncertain_outcome; read the endpoint before retrying.

Example Usage

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

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

async function run() {
  const result = await vercel.networking.createPrivateLinkEndpoint({
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      projectId: "prj_a1b2c3d4e5f6g7h8",
      name: "payments-db",
      vercelRegion: "iad1",
      awsServiceName: "com.amazonaws.vpce.us-east-1.vpce-svc-0123456789abcdef0",
      enablePrivateDns: false,
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { networkingCreatePrivateLinkEndpoint } from "@vercel/sdk/funcs/networkingCreatePrivateLinkEndpoint.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 networkingCreatePrivateLinkEndpoint(vercel, {
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      projectId: "prj_a1b2c3d4e5f6g7h8",
      name: "payments-db",
      vercelRegion: "iad1",
      awsServiceName: "com.amazonaws.vpce.us-east-1.vpce-svc-0123456789abcdef0",
      enablePrivateDns: false,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("networkingCreatePrivateLinkEndpoint failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.CreatePrivateLinkEndpointRequest ✔️ 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.PrivateLinkEndpoint>

Errors

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

listPrivateLinkEndpoints

Lists all PrivateLink endpoints 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.networking.listPrivateLinkEndpoints({
    projectId: "prj_a1b2c3d4e5f6g7h8",
    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 { networkingListPrivateLinkEndpoints } from "@vercel/sdk/funcs/networkingListPrivateLinkEndpoints.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 networkingListPrivateLinkEndpoints(vercel, {
    projectId: "prj_a1b2c3d4e5f6g7h8",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("networkingListPrivateLinkEndpoints failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.ListPrivateLinkEndpointsRequest ✔️ 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.PrivateLinkEndpoint[]>

Errors

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

readPrivateLinkEndpoint

Reads a single PrivateLink endpoint.

Example Usage

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

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

async function run() {
  const result = await vercel.networking.readPrivateLinkEndpoint({
    projectId: "prj_a1b2c3d4e5f6g7h8",
    endpointId: "ple_a1b2c3d4e5f6g7h8",
    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 { networkingReadPrivateLinkEndpoint } from "@vercel/sdk/funcs/networkingReadPrivateLinkEndpoint.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 networkingReadPrivateLinkEndpoint(vercel, {
    projectId: "prj_a1b2c3d4e5f6g7h8",
    endpointId: "ple_a1b2c3d4e5f6g7h8",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("networkingReadPrivateLinkEndpoint failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.ReadPrivateLinkEndpointRequest ✔️ 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.PrivateLinkEndpoint>

Errors

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

deletePrivateLinkEndpoint

Deletes a PrivateLink endpoint. The endpoint is removed asynchronously. Repeating the request for an endpoint that is already being deleted retries its cleanup and also returns 204. Changes to endpoints of the same project are serialized. If another change holds them for too long, the request fails with 503 service_unavailable and can be retried. If the change may have completed but the outcome is unknown, it fails with 409 uncertain_outcome; read the endpoint before retrying.

Example Usage

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

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

async function run() {
  const result = await vercel.networking.deletePrivateLinkEndpoint({
    projectId: "prj_a1b2c3d4e5f6g7h8",
    endpointId: "ple_a1b2c3d4e5f6g7h8",
    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 { networkingDeletePrivateLinkEndpoint } from "@vercel/sdk/funcs/networkingDeletePrivateLinkEndpoint.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 networkingDeletePrivateLinkEndpoint(vercel, {
    projectId: "prj_a1b2c3d4e5f6g7h8",
    endpointId: "ple_a1b2c3d4e5f6g7h8",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("networkingDeletePrivateLinkEndpoint failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.DeletePrivateLinkEndpointRequest ✔️ 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<any>

Errors

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

updatePrivateLinkEndpoint

Updates a PrivateLink endpoint (name, privateDns). Changes to endpoints of the same project are serialized. If another change holds them for too long, the request fails with 503 service_unavailable and can be retried. If the change may have completed but the outcome is unknown, it fails with 409 uncertain_outcome; read the endpoint before retrying.

Example Usage

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

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

async function run() {
  const result = await vercel.networking.updatePrivateLinkEndpoint({
    projectId: "prj_a1b2c3d4e5f6g7h8",
    endpointId: "ple_a1b2c3d4e5f6g7h8",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      name: "payments-db",
      enablePrivateDns: false,
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { networkingUpdatePrivateLinkEndpoint } from "@vercel/sdk/funcs/networkingUpdatePrivateLinkEndpoint.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 networkingUpdatePrivateLinkEndpoint(vercel, {
    projectId: "prj_a1b2c3d4e5f6g7h8",
    endpointId: "ple_a1b2c3d4e5f6g7h8",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      name: "payments-db",
      enablePrivateDns: false,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("networkingUpdatePrivateLinkEndpoint failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.UpdatePrivateLinkEndpointRequest ✔️ 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.PrivateLinkEndpoint>

Errors

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

updateStaticIps

Allows configuring Static IPs 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.networking.updateStaticIps({
    idOrName: "<value>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      regions: [
        "iad1",
      ],
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { networkingUpdateStaticIps } from "@vercel/sdk/funcs/networkingUpdateStaticIps.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 networkingUpdateStaticIps(vercel, {
    idOrName: "<value>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      regions: [
        "iad1",
      ],
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("networkingUpdateStaticIps failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.UpdateStaticIpsRequest ✔️ 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.UpdateStaticIpsResponseBody[]>

Errors

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