@gcnv/gcnv-mcp-server 1.0.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.
- package/GEMINI.md +200 -0
- package/LICENSE +201 -0
- package/README.md +374 -0
- package/build/index.js +185 -0
- package/build/logger.js +19 -0
- package/build/registry/register-tools.js +101 -0
- package/build/registry/tool-registry.js +27 -0
- package/build/tools/active-directory-tools.js +124 -0
- package/build/tools/backup-policy-tools.js +140 -0
- package/build/tools/backup-tools.js +178 -0
- package/build/tools/backup-vault-tools.js +147 -0
- package/build/tools/handlers/active-directory-handler.js +321 -0
- package/build/tools/handlers/backup-handler.js +451 -0
- package/build/tools/handlers/backup-policy-handler.js +275 -0
- package/build/tools/handlers/backup-vault-handler.js +370 -0
- package/build/tools/handlers/kms-config-handler.js +327 -0
- package/build/tools/handlers/operation-handler.js +254 -0
- package/build/tools/handlers/quota-rule-handler.js +411 -0
- package/build/tools/handlers/replication-handler.js +504 -0
- package/build/tools/handlers/snapshot-handler.js +320 -0
- package/build/tools/handlers/storage-pool-handler.js +346 -0
- package/build/tools/handlers/volume-handler.js +353 -0
- package/build/tools/kms-config-tools.js +162 -0
- package/build/tools/operation-tools.js +64 -0
- package/build/tools/quota-rule-tools.js +166 -0
- package/build/tools/replication-tools.js +227 -0
- package/build/tools/snapshot-tools.js +124 -0
- package/build/tools/storage-pool-tools.js +215 -0
- package/build/tools/volume-tools.js +216 -0
- package/build/types/tool.js +1 -0
- package/build/utils/netapp-client-factory.js +53 -0
- package/gemini-extension.json +12 -0
- package/package.json +66 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Create Backup Vault Tool
|
|
3
|
+
export const createBackupVaultTool = {
|
|
4
|
+
name: 'gcnv_backup_vault_create',
|
|
5
|
+
title: 'Create Backup Vault',
|
|
6
|
+
description: 'Creates a new backup vault in the specified project and location',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
projectId: z.string().describe('The ID of the Google Cloud project'),
|
|
9
|
+
location: z.string().describe('The location where the backup vault should be created'),
|
|
10
|
+
backupVaultId: z.string().describe('The ID to assign to the backup vault'),
|
|
11
|
+
description: z.string().optional().describe('Optional description of the backup vault'),
|
|
12
|
+
labels: z
|
|
13
|
+
.record(z.string())
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Optional labels to apply to the backup vault'),
|
|
16
|
+
},
|
|
17
|
+
outputSchema: {
|
|
18
|
+
name: z.string().describe('The name of the created backup vault'),
|
|
19
|
+
operationId: z
|
|
20
|
+
.string()
|
|
21
|
+
.describe('The ID of the long-running operation for creating the backup vault'),
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
// Delete Backup Vault Tool
|
|
25
|
+
export const deleteBackupVaultTool = {
|
|
26
|
+
name: 'gcnv_backup_vault_delete',
|
|
27
|
+
title: 'Delete Backup Vault',
|
|
28
|
+
description: 'Deletes a backup vault in the specified project and location',
|
|
29
|
+
inputSchema: {
|
|
30
|
+
projectId: z.string().describe('The ID of the Google Cloud project'),
|
|
31
|
+
location: z.string().describe('The location of the backup vault'),
|
|
32
|
+
backupVaultId: z.string().describe('The ID of the backup vault to delete'),
|
|
33
|
+
force: z.boolean().optional().describe('Force deletion even if the vault contains backups'),
|
|
34
|
+
},
|
|
35
|
+
outputSchema: {
|
|
36
|
+
success: z.boolean().describe('Whether the deletion was successful'),
|
|
37
|
+
operationId: z.string().optional().describe('The ID of the long-running operation'),
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
// Get Backup Vault Tool
|
|
41
|
+
export const getBackupVaultTool = {
|
|
42
|
+
name: 'gcnv_backup_vault_get',
|
|
43
|
+
title: 'Get Backup Vault',
|
|
44
|
+
description: 'Gets details of a specific backup vault',
|
|
45
|
+
inputSchema: {
|
|
46
|
+
projectId: z.string().describe('The ID of the Google Cloud project'),
|
|
47
|
+
location: z.string().describe('The location of the backup vault'),
|
|
48
|
+
backupVaultId: z.string().describe('The ID of the backup vault to retrieve'),
|
|
49
|
+
},
|
|
50
|
+
outputSchema: {
|
|
51
|
+
name: z.string().describe('The fully qualified name of the backup vault'),
|
|
52
|
+
backupVaultId: z.string().describe('The ID of the backup vault to retrieve'),
|
|
53
|
+
backupVaultType: z.string().describe('The type of the backup vault'),
|
|
54
|
+
sourceRegion: z.string().optional().describe('The source region of the backup vault'),
|
|
55
|
+
backupRegion: z.string().optional().describe('The backup region of the backup vault'),
|
|
56
|
+
sourceBackupVault: z
|
|
57
|
+
.string()
|
|
58
|
+
.optional()
|
|
59
|
+
.describe('The source backup vault for cross-region backups'),
|
|
60
|
+
destinationBackupVault: z
|
|
61
|
+
.string()
|
|
62
|
+
.optional()
|
|
63
|
+
.describe('The destination backup vault for cross-region backups'),
|
|
64
|
+
backupRetentionPolicy: z
|
|
65
|
+
.object({
|
|
66
|
+
backupMinimumEnforcedRetentionDays: z
|
|
67
|
+
.number()
|
|
68
|
+
.describe('The minimum enforced retention days for backups'),
|
|
69
|
+
dailyBackupImmutable: z.boolean().describe('Whether daily backups are immutable'),
|
|
70
|
+
weeklyBackupImmutable: z.boolean().describe('Whether weekly backups are immutable'),
|
|
71
|
+
monthlyBackupImmutable: z.boolean().describe('Whether monthly backups are immutable'),
|
|
72
|
+
manualBackupImmutable: z.boolean().describe('Whether manual backups are immutable'),
|
|
73
|
+
})
|
|
74
|
+
.optional()
|
|
75
|
+
.describe('The backup retention policy of the backup vault'),
|
|
76
|
+
state: z.string().describe('The current state of the backup vault'),
|
|
77
|
+
createTime: z.date().describe('The creation time of the backup vault'),
|
|
78
|
+
description: z.string().optional().describe('Description of the backup vault'),
|
|
79
|
+
labels: z.record(z.string()).optional().describe('Labels applied to the backup vault'),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
// List Backup Vaults Tool
|
|
83
|
+
export const listBackupVaultsTool = {
|
|
84
|
+
name: 'gcnv_backup_vault_list',
|
|
85
|
+
title: 'List Backup Vaults',
|
|
86
|
+
description: 'Lists backup vaults in a specific project and location',
|
|
87
|
+
inputSchema: {
|
|
88
|
+
projectId: z.string().describe('The ID of the Google Cloud project'),
|
|
89
|
+
location: z.string().describe('The location to list backup vaults from'),
|
|
90
|
+
filter: z.string().optional().describe('Filter expression for filtering results'),
|
|
91
|
+
pageSize: z.number().optional().describe('Maximum number of backup vaults to return per page'),
|
|
92
|
+
pageToken: z.string().optional().describe('Page token from a previous list request'),
|
|
93
|
+
},
|
|
94
|
+
outputSchema: {
|
|
95
|
+
backupVaults: z
|
|
96
|
+
.array(z.object({
|
|
97
|
+
name: z.string().describe('The fully qualified name of the backup vault'),
|
|
98
|
+
backupVaultId: z.string().describe('The ID of the backup vault to retrieve'),
|
|
99
|
+
backupVaultType: z.string().describe('The type of the backup vault'),
|
|
100
|
+
sourceRegion: z.string().optional().describe('The source region of the backup vault'),
|
|
101
|
+
backupRegion: z.string().optional().describe('The backup region of the backup vault'),
|
|
102
|
+
sourceBackupVault: z
|
|
103
|
+
.string()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe('The source backup vault for cross-region backups'),
|
|
106
|
+
destinationBackupVault: z
|
|
107
|
+
.string()
|
|
108
|
+
.optional()
|
|
109
|
+
.describe('The destination backup vault for cross-region backups'),
|
|
110
|
+
backupRetentionPolicy: z
|
|
111
|
+
.object({
|
|
112
|
+
backupMinimumEnforcedRetentionDays: z
|
|
113
|
+
.number()
|
|
114
|
+
.describe('The minimum enforced retention days for backups'),
|
|
115
|
+
dailyBackupImmutable: z.boolean().describe('Whether daily backups are immutable'),
|
|
116
|
+
weeklyBackupImmutable: z.boolean().describe('Whether weekly backups are immutable'),
|
|
117
|
+
monthlyBackupImmutable: z.boolean().describe('Whether monthly backups are immutable'),
|
|
118
|
+
manualBackupImmutable: z.boolean().describe('Whether manual backups are immutable'),
|
|
119
|
+
})
|
|
120
|
+
.optional()
|
|
121
|
+
.describe('The backup retention policy of the backup vault'),
|
|
122
|
+
state: z.string().describe('The current state of the backup vault'),
|
|
123
|
+
createTime: z.date().describe('The creation time of the backup vault'),
|
|
124
|
+
description: z.string().optional().describe('Description of the backup vault'),
|
|
125
|
+
labels: z.record(z.string()).optional().describe('Labels applied to the backup vault'),
|
|
126
|
+
}))
|
|
127
|
+
.describe('List of backup vaults'),
|
|
128
|
+
nextPageToken: z.string().optional().describe('Token for fetching the next page'),
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
// Update Backup Vault Tool
|
|
132
|
+
export const updateBackupVaultTool = {
|
|
133
|
+
name: 'gcnv_backup_vault_update',
|
|
134
|
+
title: 'Update Backup Vault',
|
|
135
|
+
description: 'Updates the properties of an existing backup vault',
|
|
136
|
+
inputSchema: {
|
|
137
|
+
projectId: z.string().describe('The ID of the Google Cloud project'),
|
|
138
|
+
location: z.string().describe('The location of the backup vault'),
|
|
139
|
+
backupVaultId: z.string().describe('The ID of the backup vault to update'),
|
|
140
|
+
description: z.string().optional().describe('New description for the backup vault'),
|
|
141
|
+
labels: z.record(z.string()).optional().describe('New labels to apply to the backup vault'),
|
|
142
|
+
},
|
|
143
|
+
outputSchema: {
|
|
144
|
+
name: z.string().describe('The fully qualified name of the updated backup vault'),
|
|
145
|
+
operationId: z.string().describe('The ID of the long-running operation'),
|
|
146
|
+
},
|
|
147
|
+
};
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { NetAppClientFactory } from '../../utils/netapp-client-factory.js';
|
|
2
|
+
import { logger } from '../../logger.js';
|
|
3
|
+
const log = logger.child({ module: 'active-directory-handler' });
|
|
4
|
+
// Helper to format active directory data
|
|
5
|
+
function formatActiveDirectoryData(ad) {
|
|
6
|
+
const result = {};
|
|
7
|
+
if (!ad)
|
|
8
|
+
return result;
|
|
9
|
+
if (ad.name) {
|
|
10
|
+
const nameParts = ad.name.split('/');
|
|
11
|
+
result.name = ad.name;
|
|
12
|
+
result.activeDirectoryId = nameParts[nameParts.length - 1];
|
|
13
|
+
}
|
|
14
|
+
if (ad.domain)
|
|
15
|
+
result.domain = ad.domain;
|
|
16
|
+
if (ad.site)
|
|
17
|
+
result.site = ad.site;
|
|
18
|
+
if (ad.dns)
|
|
19
|
+
result.dns = ad.dns;
|
|
20
|
+
if (ad.netBiosPrefix)
|
|
21
|
+
result.netBiosPrefix = ad.netBiosPrefix;
|
|
22
|
+
if (ad.organizationalUnit)
|
|
23
|
+
result.organizationalUnit = ad.organizationalUnit;
|
|
24
|
+
if (ad.aesEncryption !== undefined)
|
|
25
|
+
result.aesEncryption = ad.aesEncryption;
|
|
26
|
+
if (ad.state)
|
|
27
|
+
result.state = ad.state;
|
|
28
|
+
if (ad.createTime) {
|
|
29
|
+
result.createTime = new Date(ad.createTime.seconds * 1000);
|
|
30
|
+
}
|
|
31
|
+
if (ad.description)
|
|
32
|
+
result.description = ad.description;
|
|
33
|
+
if (ad.labels)
|
|
34
|
+
result.labels = ad.labels;
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
// Create Active Directory Handler
|
|
38
|
+
export const createActiveDirectoryHandler = async (args) => {
|
|
39
|
+
try {
|
|
40
|
+
const { projectId, location, activeDirectoryId, domain, site, dns, netBiosPrefix, organizationalUnit, aesEncryption, username, password, backupOperators, securityOperators, kdcHostname, kdcIp, nfsUsersWithLdap, description, labels, } = args;
|
|
41
|
+
const netAppClient = NetAppClientFactory.createClient();
|
|
42
|
+
const parent = `projects/${projectId}/locations/${location}`;
|
|
43
|
+
const activeDirectory = {};
|
|
44
|
+
if (domain)
|
|
45
|
+
activeDirectory.domain = domain;
|
|
46
|
+
if (site)
|
|
47
|
+
activeDirectory.site = site;
|
|
48
|
+
if (dns)
|
|
49
|
+
activeDirectory.dns = dns;
|
|
50
|
+
if (netBiosPrefix)
|
|
51
|
+
activeDirectory.netBiosPrefix = netBiosPrefix;
|
|
52
|
+
if (organizationalUnit)
|
|
53
|
+
activeDirectory.organizationalUnit = organizationalUnit;
|
|
54
|
+
if (aesEncryption !== undefined)
|
|
55
|
+
activeDirectory.aesEncryption = aesEncryption;
|
|
56
|
+
if (username)
|
|
57
|
+
activeDirectory.username = username;
|
|
58
|
+
if (password)
|
|
59
|
+
activeDirectory.password = password;
|
|
60
|
+
if (backupOperators)
|
|
61
|
+
activeDirectory.backupOperators = backupOperators;
|
|
62
|
+
if (securityOperators)
|
|
63
|
+
activeDirectory.securityOperators = securityOperators;
|
|
64
|
+
if (kdcHostname)
|
|
65
|
+
activeDirectory.kdcHostname = kdcHostname;
|
|
66
|
+
if (kdcIp)
|
|
67
|
+
activeDirectory.kdcIp = kdcIp;
|
|
68
|
+
if (nfsUsersWithLdap !== undefined)
|
|
69
|
+
activeDirectory.nfsUsersWithLdap = nfsUsersWithLdap;
|
|
70
|
+
if (description)
|
|
71
|
+
activeDirectory.description = description;
|
|
72
|
+
if (labels)
|
|
73
|
+
activeDirectory.labels = labels;
|
|
74
|
+
const request = {
|
|
75
|
+
parent,
|
|
76
|
+
activeDirectoryId,
|
|
77
|
+
activeDirectory,
|
|
78
|
+
};
|
|
79
|
+
log.info({ request }, 'Create Active Directory request');
|
|
80
|
+
const [operation] = await netAppClient.createActiveDirectory(request);
|
|
81
|
+
log.info({ operation }, 'Create Active Directory operation');
|
|
82
|
+
return {
|
|
83
|
+
content: [
|
|
84
|
+
{
|
|
85
|
+
type: 'text',
|
|
86
|
+
text: JSON.stringify({
|
|
87
|
+
name: `projects/${projectId}/locations/${location}/activeDirectories/${activeDirectoryId}`,
|
|
88
|
+
operation: operation,
|
|
89
|
+
}, null, 2),
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
structuredContent: {
|
|
93
|
+
name: `projects/${projectId}/locations/${location}/activeDirectories/${activeDirectoryId}`,
|
|
94
|
+
operationId: operation.name || '',
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
log.error({ err: error }, 'Error creating active directory');
|
|
100
|
+
return {
|
|
101
|
+
isError: true,
|
|
102
|
+
content: [
|
|
103
|
+
{
|
|
104
|
+
type: 'text',
|
|
105
|
+
text: `Error creating active directory: ${error.message || 'Unknown error'}`,
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
// Delete Active Directory Handler
|
|
112
|
+
export const deleteActiveDirectoryHandler = async (args) => {
|
|
113
|
+
try {
|
|
114
|
+
const { projectId, location, activeDirectoryId } = args;
|
|
115
|
+
const netAppClient = NetAppClientFactory.createClient();
|
|
116
|
+
const name = `projects/${projectId}/locations/${location}/activeDirectories/${activeDirectoryId}`;
|
|
117
|
+
const [operation] = await netAppClient.deleteActiveDirectory({ name });
|
|
118
|
+
return {
|
|
119
|
+
content: [
|
|
120
|
+
{
|
|
121
|
+
type: 'text',
|
|
122
|
+
text: JSON.stringify({
|
|
123
|
+
message: `Active directory ${activeDirectoryId} deletion requested`,
|
|
124
|
+
operation: operation,
|
|
125
|
+
}, null, 2),
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
structuredContent: {
|
|
129
|
+
success: true,
|
|
130
|
+
operationId: operation.name || '',
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
log.error({ err: error }, 'Error deleting active directory');
|
|
136
|
+
return {
|
|
137
|
+
isError: true,
|
|
138
|
+
content: [
|
|
139
|
+
{
|
|
140
|
+
type: 'text',
|
|
141
|
+
text: `Error deleting active directory: ${error.message || 'Unknown error'}`,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
// Get Active Directory Handler
|
|
148
|
+
export const getActiveDirectoryHandler = async (args) => {
|
|
149
|
+
try {
|
|
150
|
+
const { projectId, location, activeDirectoryId } = args;
|
|
151
|
+
const netAppClient = NetAppClientFactory.createClient();
|
|
152
|
+
const name = `projects/${projectId}/locations/${location}/activeDirectories/${activeDirectoryId}`;
|
|
153
|
+
const [activeDirectory] = await netAppClient.getActiveDirectory({ name });
|
|
154
|
+
const formatted = formatActiveDirectoryData(activeDirectory);
|
|
155
|
+
return {
|
|
156
|
+
content: [
|
|
157
|
+
{
|
|
158
|
+
type: 'text',
|
|
159
|
+
text: JSON.stringify(formatted, null, 2),
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
structuredContent: formatted,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
log.error({ err: error }, 'Error getting active directory');
|
|
167
|
+
return {
|
|
168
|
+
isError: true,
|
|
169
|
+
content: [
|
|
170
|
+
{
|
|
171
|
+
type: 'text',
|
|
172
|
+
text: `Error getting active directory: ${error.message || 'Unknown error'}`,
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
// List Active Directories Handler
|
|
179
|
+
export const listActiveDirectoriesHandler = async (args) => {
|
|
180
|
+
try {
|
|
181
|
+
const { projectId, location, filter, pageSize, pageToken } = args;
|
|
182
|
+
const netAppClient = NetAppClientFactory.createClient();
|
|
183
|
+
const parent = `projects/${projectId}/locations/${location}`;
|
|
184
|
+
const request = { parent };
|
|
185
|
+
if (filter)
|
|
186
|
+
request.filter = filter;
|
|
187
|
+
if (pageSize)
|
|
188
|
+
request.pageSize = pageSize;
|
|
189
|
+
if (pageToken)
|
|
190
|
+
request.pageToken = pageToken;
|
|
191
|
+
const [activeDirectories, , response] = await netAppClient.listActiveDirectories(request);
|
|
192
|
+
const formatted = activeDirectories.map(formatActiveDirectoryData);
|
|
193
|
+
return {
|
|
194
|
+
content: [
|
|
195
|
+
{
|
|
196
|
+
type: 'text',
|
|
197
|
+
text: JSON.stringify({ activeDirectories, nextPageToken: response?.nextPageToken }, null, 2),
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
structuredContent: {
|
|
201
|
+
activeDirectories: formatted,
|
|
202
|
+
nextPageToken: response?.nextPageToken,
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
log.error({ err: error }, 'Error listing active directories');
|
|
208
|
+
return {
|
|
209
|
+
isError: true,
|
|
210
|
+
content: [
|
|
211
|
+
{
|
|
212
|
+
type: 'text',
|
|
213
|
+
text: `Error listing active directories: ${error.message || 'Unknown error'}`,
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
// Update Active Directory Handler
|
|
220
|
+
export const updateActiveDirectoryHandler = async (args) => {
|
|
221
|
+
try {
|
|
222
|
+
const { projectId, location, activeDirectoryId, domain, site, dns, netBiosPrefix, organizationalUnit, aesEncryption, username, password, backupOperators, securityOperators, kdcHostname, kdcIp, nfsUsersWithLdap, description, labels, } = args;
|
|
223
|
+
const netAppClient = NetAppClientFactory.createClient();
|
|
224
|
+
const name = `projects/${projectId}/locations/${location}/activeDirectories/${activeDirectoryId}`;
|
|
225
|
+
const updateMask = [];
|
|
226
|
+
const activeDirectory = { name };
|
|
227
|
+
if (domain !== undefined) {
|
|
228
|
+
activeDirectory.domain = domain;
|
|
229
|
+
updateMask.push('domain');
|
|
230
|
+
}
|
|
231
|
+
if (site !== undefined) {
|
|
232
|
+
activeDirectory.site = site;
|
|
233
|
+
updateMask.push('site');
|
|
234
|
+
}
|
|
235
|
+
if (dns !== undefined) {
|
|
236
|
+
activeDirectory.dns = dns;
|
|
237
|
+
updateMask.push('dns');
|
|
238
|
+
}
|
|
239
|
+
if (netBiosPrefix !== undefined) {
|
|
240
|
+
activeDirectory.netBiosPrefix = netBiosPrefix;
|
|
241
|
+
updateMask.push('net_bios_prefix');
|
|
242
|
+
}
|
|
243
|
+
if (organizationalUnit !== undefined) {
|
|
244
|
+
activeDirectory.organizationalUnit = organizationalUnit;
|
|
245
|
+
updateMask.push('organizational_unit');
|
|
246
|
+
}
|
|
247
|
+
if (aesEncryption !== undefined) {
|
|
248
|
+
activeDirectory.aesEncryption = aesEncryption;
|
|
249
|
+
updateMask.push('aes_encryption');
|
|
250
|
+
}
|
|
251
|
+
if (username !== undefined) {
|
|
252
|
+
activeDirectory.username = username;
|
|
253
|
+
updateMask.push('username');
|
|
254
|
+
}
|
|
255
|
+
if (password !== undefined) {
|
|
256
|
+
activeDirectory.password = password;
|
|
257
|
+
updateMask.push('password');
|
|
258
|
+
}
|
|
259
|
+
if (backupOperators !== undefined) {
|
|
260
|
+
activeDirectory.backupOperators = backupOperators;
|
|
261
|
+
updateMask.push('backup_operators');
|
|
262
|
+
}
|
|
263
|
+
if (securityOperators !== undefined) {
|
|
264
|
+
activeDirectory.securityOperators = securityOperators;
|
|
265
|
+
updateMask.push('security_operators');
|
|
266
|
+
}
|
|
267
|
+
if (kdcHostname !== undefined) {
|
|
268
|
+
activeDirectory.kdcHostname = kdcHostname;
|
|
269
|
+
updateMask.push('kdc_hostname');
|
|
270
|
+
}
|
|
271
|
+
if (kdcIp !== undefined) {
|
|
272
|
+
activeDirectory.kdcIp = kdcIp;
|
|
273
|
+
updateMask.push('kdc_ip');
|
|
274
|
+
}
|
|
275
|
+
if (nfsUsersWithLdap !== undefined) {
|
|
276
|
+
activeDirectory.nfsUsersWithLdap = nfsUsersWithLdap;
|
|
277
|
+
updateMask.push('nfs_users_with_ldap');
|
|
278
|
+
}
|
|
279
|
+
if (description !== undefined) {
|
|
280
|
+
activeDirectory.description = description;
|
|
281
|
+
updateMask.push('description');
|
|
282
|
+
}
|
|
283
|
+
if (labels !== undefined) {
|
|
284
|
+
activeDirectory.labels = labels;
|
|
285
|
+
updateMask.push('labels');
|
|
286
|
+
}
|
|
287
|
+
const request = {
|
|
288
|
+
activeDirectory,
|
|
289
|
+
updateMask: { paths: updateMask },
|
|
290
|
+
};
|
|
291
|
+
log.info({ request }, 'Update Active Directory request');
|
|
292
|
+
const [operation] = await netAppClient.updateActiveDirectory(request);
|
|
293
|
+
return {
|
|
294
|
+
content: [
|
|
295
|
+
{
|
|
296
|
+
type: 'text',
|
|
297
|
+
text: JSON.stringify({
|
|
298
|
+
message: `Active directory ${activeDirectoryId} update requested`,
|
|
299
|
+
operation: operation,
|
|
300
|
+
}, null, 2),
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
structuredContent: {
|
|
304
|
+
name: name,
|
|
305
|
+
operationId: operation.name || '',
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
log.error({ err: error }, 'Error updating active directory');
|
|
311
|
+
return {
|
|
312
|
+
isError: true,
|
|
313
|
+
content: [
|
|
314
|
+
{
|
|
315
|
+
type: 'text',
|
|
316
|
+
text: `Error updating active directory: ${error.message || 'Unknown error'}`,
|
|
317
|
+
},
|
|
318
|
+
],
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
};
|