neonctl 1.24.2 → 1.24.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { log } from '../log.js';
2
- import { projectCreateRequest } from '../parameters.gen.js';
2
+ import { projectCreateRequest, projectUpdateRequest, } from '../parameters.gen.js';
3
3
  import { writer } from '../writer.js';
4
4
  import { psql } from '../utils/psql.js';
5
5
  import { updateContextFile } from '../context.js';
@@ -49,6 +49,16 @@ export const builder = (argv) => {
49
49
  describe: projectCreateRequest['project.name'].description,
50
50
  type: 'string',
51
51
  },
52
+ 'ip-allow': {
53
+ describe: projectUpdateRequest['project.settings.allowed_ips.ips']
54
+ .description,
55
+ type: 'string',
56
+ array: true,
57
+ },
58
+ 'ip-primary-only': {
59
+ describe: projectUpdateRequest['project.settings.allowed_ips.primary_branch_only'].description,
60
+ type: 'boolean',
61
+ },
52
62
  }), async (args) => {
53
63
  await update(args);
54
64
  })
@@ -117,10 +127,24 @@ const deleteProject = async (props) => {
117
127
  });
118
128
  };
119
129
  const update = async (props) => {
130
+ const project = {};
131
+ if (props.name) {
132
+ project.name = props.name;
133
+ }
134
+ if (props.ipAllow || props.ipPrimaryOnly != undefined) {
135
+ const { data } = await props.apiClient.getProject(props.id);
136
+ const existingAllowedIps = data.project.settings?.allowed_ips;
137
+ project.settings = {
138
+ allowed_ips: {
139
+ ips: props.ipAllow ?? existingAllowedIps?.ips ?? [],
140
+ primary_branch_only: props.ipPrimaryOnly ??
141
+ existingAllowedIps?.primary_branch_only ??
142
+ false,
143
+ },
144
+ };
145
+ }
120
146
  const { data } = await props.apiClient.updateProject(props.id, {
121
- project: {
122
- name: props.name,
123
- },
147
+ project,
124
148
  });
125
149
  writer(props).end(data.project, { fields: PROJECT_FIELDS });
126
150
  };
@@ -71,8 +71,37 @@ describe('projects', () => {
71
71
  },
72
72
  });
73
73
  testCliCommand({
74
- name: 'update',
75
- args: ['projects', 'update', 'test', '--name', 'test_project'],
74
+ name: 'update name',
75
+ args: ['projects', 'update', 'test', '--name', 'test_project_new_name'],
76
+ expected: {
77
+ snapshot: true,
78
+ },
79
+ });
80
+ testCliCommand({
81
+ name: 'update ip allow',
82
+ args: [
83
+ 'projects',
84
+ 'update',
85
+ 'test',
86
+ '--ip-allow',
87
+ '127.0.0.1',
88
+ '192.168.1.2/22',
89
+ '--ip-primary-only',
90
+ ],
91
+ expected: {
92
+ snapshot: true,
93
+ },
94
+ });
95
+ testCliCommand({
96
+ name: 'update ip allow primary only flag',
97
+ args: ['projects', 'update', 'test', '--ip-primary-only', 'false'],
98
+ expected: {
99
+ snapshot: true,
100
+ },
101
+ });
102
+ testCliCommand({
103
+ name: 'update ip allow remove',
104
+ args: ['projects', 'update', 'test', '--ip-allow'],
76
105
  expected: {
77
106
  snapshot: true,
78
107
  },
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git@github.com:neondatabase/neonctl.git"
6
6
  },
7
7
  "type": "module",
8
- "version": "1.24.2",
8
+ "version": "1.24.3",
9
9
  "description": "CLI tool for NeonDB Cloud management",
10
10
  "main": "index.js",
11
11
  "author": "NeonDB",
@@ -53,7 +53,7 @@
53
53
  "typescript": "^4.7.4"
54
54
  },
55
55
  "dependencies": {
56
- "@neondatabase/api-client": "1.1.0",
56
+ "@neondatabase/api-client": "1.4.1",
57
57
  "@segment/analytics-node": "^1.0.0-beta.26",
58
58
  "axios": "^1.4.0",
59
59
  "axios-debug-log": "^1.0.0",
package/parameters.gen.js CHANGED
@@ -2,22 +2,22 @@
2
2
  export const projectCreateRequest = {
3
3
  'project.settings.quota.active_time_seconds': {
4
4
  type: "number",
5
- description: "The total amount of wall-clock time allowed to be spent by project's compute endpoints.\n",
5
+ description: "The total amount of wall-clock time allowed to be spent by the project's compute endpoints.\n",
6
6
  demandOption: false,
7
7
  },
8
8
  'project.settings.quota.compute_time_seconds': {
9
9
  type: "number",
10
- description: "The total amount of CPU seconds allowed to be spent by project's compute endpoints.\n",
10
+ description: "The total amount of CPU seconds allowed to be spent by the project's compute endpoints.\n",
11
11
  demandOption: false,
12
12
  },
13
13
  'project.settings.quota.written_data_bytes': {
14
14
  type: "number",
15
- description: "Total amount of data written to all project's branches.\n",
15
+ description: "Total amount of data written to all of a project's branches.\n",
16
16
  demandOption: false,
17
17
  },
18
18
  'project.settings.quota.data_transfer_bytes': {
19
19
  type: "number",
20
- description: "Total amount of data transferred from all project's branches using proxy.\n",
20
+ description: "Total amount of data transferred from all of a project's branches using the proxy.\n",
21
21
  demandOption: false,
22
22
  },
23
23
  'project.settings.quota.logical_size_bytes': {
@@ -25,6 +25,16 @@ export const projectCreateRequest = {
25
25
  description: "Limit on the logical size of every project's branch.\n",
26
26
  demandOption: false,
27
27
  },
28
+ 'project.settings.allowed_ips.ips': {
29
+ type: "array",
30
+ description: "A list of IP addresses that are allowed to connect to the endpoint.",
31
+ demandOption: true,
32
+ },
33
+ 'project.settings.allowed_ips.primary_branch_only': {
34
+ type: "boolean",
35
+ description: "If true, the list will be applied only to the primary branch.",
36
+ demandOption: true,
37
+ },
28
38
  'project.name': {
29
39
  type: "string",
30
40
  description: "The project name",
@@ -47,18 +57,23 @@ export const projectCreateRequest = {
47
57
  },
48
58
  'project.provisioner': {
49
59
  type: "string",
50
- description: "The Neon compute provisioner.\n",
60
+ description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n",
51
61
  demandOption: false,
52
- choices: ["k8s-pod", "k8s-neonvm", "docker"],
62
+ choices: ["k8s-pod", "k8s-neonvm"],
53
63
  },
54
64
  'project.region_id': {
55
65
  type: "string",
56
- description: "The region identifier. See [the documentation](https://neon.tech/docs/introduction/regions) for the list of supported regions.\n",
66
+ description: "The region identifier. Refer to our [Regions](https://neon.tech/docs/introduction/regions) documentation for supported regions. Values are specified in this format: `aws-us-east-1`\n",
67
+ demandOption: false,
68
+ },
69
+ 'project.default_endpoint_settings.suspend_timeout_seconds': {
70
+ type: "number",
71
+ description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
57
72
  demandOption: false,
58
73
  },
59
74
  'project.pg_version': {
60
75
  type: "number",
61
- description: "The major PostgreSQL version number. Currently supported version are `14` and `15`.",
76
+ description: "The major PostgreSQL version number. Currently supported versions are `14`, `15` and `16`.",
62
77
  demandOption: false,
63
78
  },
64
79
  'project.store_passwords': {
@@ -68,14 +83,71 @@ export const projectCreateRequest = {
68
83
  },
69
84
  'project.history_retention_seconds': {
70
85
  type: "number",
71
- description: "The number of seconds to retain PITR backup history for this project. Defaults to 7 days\n",
86
+ description: "The number of seconds to retain the point-in-time restore (PITR) backup history for this project.\nThe default is 604800 seconds (7 days).\n",
87
+ demandOption: false,
88
+ },
89
+ };
90
+ export const projectUpdateRequest = {
91
+ 'project.settings.quota.active_time_seconds': {
92
+ type: "number",
93
+ description: "The total amount of wall-clock time allowed to be spent by the project's compute endpoints.\n",
94
+ demandOption: false,
95
+ },
96
+ 'project.settings.quota.compute_time_seconds': {
97
+ type: "number",
98
+ description: "The total amount of CPU seconds allowed to be spent by the project's compute endpoints.\n",
99
+ demandOption: false,
100
+ },
101
+ 'project.settings.quota.written_data_bytes': {
102
+ type: "number",
103
+ description: "Total amount of data written to all of a project's branches.\n",
104
+ demandOption: false,
105
+ },
106
+ 'project.settings.quota.data_transfer_bytes': {
107
+ type: "number",
108
+ description: "Total amount of data transferred from all of a project's branches using the proxy.\n",
109
+ demandOption: false,
110
+ },
111
+ 'project.settings.quota.logical_size_bytes': {
112
+ type: "number",
113
+ description: "Limit on the logical size of every project's branch.\n",
114
+ demandOption: false,
115
+ },
116
+ 'project.settings.allowed_ips.ips': {
117
+ type: "array",
118
+ description: "A list of IP addresses that are allowed to connect to the endpoint.",
119
+ demandOption: true,
120
+ },
121
+ 'project.settings.allowed_ips.primary_branch_only': {
122
+ type: "boolean",
123
+ description: "If true, the list will be applied only to the primary branch.",
124
+ demandOption: true,
125
+ },
126
+ 'project.name': {
127
+ type: "string",
128
+ description: "The project name",
129
+ demandOption: false,
130
+ },
131
+ 'project.default_endpoint_settings.suspend_timeout_seconds': {
132
+ type: "number",
133
+ description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
134
+ demandOption: false,
135
+ },
136
+ 'project.history_retention_seconds': {
137
+ type: "number",
138
+ description: "The number of seconds to retain the point-in-time restore (PITR) backup history for this project.\nThe default is 604800 seconds (7 days).\n",
72
139
  demandOption: false,
73
140
  },
74
141
  };
75
142
  export const branchCreateRequest = {
143
+ 'endpoints': {
144
+ type: "array",
145
+ description: undefined,
146
+ demandOption: false,
147
+ },
76
148
  'branch.parent_id': {
77
149
  type: "string",
78
- description: "The `branch_id` of the parent branch\n",
150
+ description: "The `branch_id` of the parent branch. If omitted or empty, the branch will be created from the project's primary branch.\n",
79
151
  demandOption: false,
80
152
  },
81
153
  'branch.name': {
@@ -103,13 +175,13 @@ export const branchCreateRequestEndpointOptions = {
103
175
  },
104
176
  'provisioner': {
105
177
  type: "string",
106
- description: "The Neon compute provisioner.\n",
178
+ description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n",
107
179
  demandOption: false,
108
- choices: ["k8s-pod", "k8s-neonvm", "docker"],
180
+ choices: ["k8s-pod", "k8s-neonvm"],
109
181
  },
110
182
  'suspend_timeout_seconds': {
111
183
  type: "number",
112
- description: "Duration of inactivity in seconds after which endpoint will be\nautomatically suspended. Value `0` means use global default,\n`-1` means never suspend. Maximum value is 1 week in seconds.\n",
184
+ description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
113
185
  demandOption: false,
114
186
  },
115
187
  };
@@ -139,9 +211,9 @@ export const endpointCreateRequest = {
139
211
  },
140
212
  'endpoint.provisioner': {
141
213
  type: "string",
142
- description: "The Neon compute provisioner.\n",
214
+ description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n",
143
215
  demandOption: false,
144
- choices: ["k8s-pod", "k8s-neonvm", "docker"],
216
+ choices: ["k8s-pod", "k8s-neonvm"],
145
217
  },
146
218
  'endpoint.pooler_enabled': {
147
219
  type: "boolean",
@@ -156,7 +228,7 @@ export const endpointCreateRequest = {
156
228
  },
157
229
  'endpoint.disabled': {
158
230
  type: "boolean",
159
- description: "Whether to restrict connections to the compute endpoint\n",
231
+ description: "Whether to restrict connections to the compute endpoint.\nEnabling this option schedules a suspend compute operation.\nA disabled compute endpoint cannot be enabled by a connection or\nconsole action. However, the compute endpoint is periodically\nenabled by check_availability operations.\n",
160
232
  demandOption: false,
161
233
  },
162
234
  'endpoint.passwordless_access': {
@@ -166,7 +238,7 @@ export const endpointCreateRequest = {
166
238
  },
167
239
  'endpoint.suspend_timeout_seconds': {
168
240
  type: "number",
169
- description: "Duration of inactivity in seconds after which endpoint will be\nautomatically suspended. Value `0` means use global default,\n`-1` means never suspend. Maximum value is 1 week in seconds.\n",
241
+ description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
170
242
  demandOption: false,
171
243
  },
172
244
  };
@@ -178,9 +250,9 @@ export const endpointUpdateRequest = {
178
250
  },
179
251
  'endpoint.provisioner': {
180
252
  type: "string",
181
- description: "The Neon compute provisioner.\n",
253
+ description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n",
182
254
  demandOption: false,
183
- choices: ["k8s-pod", "k8s-neonvm", "docker"],
255
+ choices: ["k8s-pod", "k8s-neonvm"],
184
256
  },
185
257
  'endpoint.pooler_enabled': {
186
258
  type: "boolean",
@@ -195,7 +267,7 @@ export const endpointUpdateRequest = {
195
267
  },
196
268
  'endpoint.disabled': {
197
269
  type: "boolean",
198
- description: "Whether to restrict connections to the compute endpoint\n",
270
+ description: "Whether to restrict connections to the compute endpoint.\nEnabling this option schedules a suspend compute operation.\nA disabled compute endpoint cannot be enabled by a connection or\nconsole action. However, the compute endpoint is periodically\nenabled by check_availability operations.\n",
199
271
  demandOption: false,
200
272
  },
201
273
  'endpoint.passwordless_access': {
@@ -205,7 +277,7 @@ export const endpointUpdateRequest = {
205
277
  },
206
278
  'endpoint.suspend_timeout_seconds': {
207
279
  type: "number",
208
- description: "Duration of inactivity in seconds after which endpoint will be\nautomatically suspended. Value `0` means use global default,\n`-1` means never suspend. Maximum value is 1 week in seconds.\n",
280
+ description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
209
281
  demandOption: false,
210
282
  },
211
283
  };