//native
type Linode = {
token: string;
};
/**
* Update the control plane access control list
* Updates a specific cluster's control plane access control list.
*/
export async function main(
auth: Linode,
apiVersion: "v4" | "v4beta",
clusterId: string,
body: {
acl?: {
addresses?: { ipv4?: string[]; ipv6?: string[] };
enabled?: false | true;
"revision-id"?: string;
};
},
) {
const url = new URL(
`https://api.linode.com/${apiVersion}/lke/clusters/${clusterId}/control_plane_acl`,
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago