-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathFileStorageExample.cs
640 lines (566 loc) · 27.5 KB
/
FileStorageExample.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
/*
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
*/
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.CoreService;
using Oci.CoreService.Models;
using Oci.CoreService.Requests;
using Oci.CoreService.Responses;
using Oci.Common.Auth;
using Oci.Common.Retry;
using Oci.Common.Waiters;
using Oci.FilestorageService;
using Oci.FilestorageService.Models;
using Oci.FilestorageService.Requests;
using Oci.FilestorageService.Responses;
using Oci.IdentityService;
using Oci.IdentityService.Models;
using Oci.IdentityService.Requests;
using Oci.IdentityService.Responses;
namespace Oci.Examples
{
/**
* This class provides an example of how to use the File Storage service in the .NET SDK.
*
* In order to demonstrate functionality for mount targets and export sets, this script will also create a VCN
* and subnet. These will be deleted at the end of the script. This script also makes some assumptions about
* the resources it will create:
*
* <ul>
* <li>The VCN created by this example will have a display name of oci_dotnet_sdk_example_vcn</li>
* <li>The subnet created by this example will have a display name of: oci_dotnet_sdk_example_subnet</li>
* <li>The VCN and subnet will have a private IP CIDR block of 10.0.0.0/16</li>
* <li>The file system export created by this example will have a path of /files</li>
* <li>
* The configuration file used by service clients will be sourced from the default
* location (~/.oci/config) and the DEFAULT profile will be used
* </li>
* <li>Resources will be created in us-phoenix-1</li>
* <li>Resources will be created in the first AD returned from the ListAvailabilityDomains call</li>
* <ul>
*
* Here we demonstrate:
*
* - Creating a new file system
* - Creating a mount target via which the file system can be accessed. The mount target and file system must
* be in the same availability domain in order to export the file system from the mount target
* - Creating an export so that we can mount the file system (see
* https://docs.cloud.oracle.com/Content/File/Tasks/mountingfilesystems.htm for more information)
* - Creating a snapshot of the file system
*
* And we'll delete these resources when we're done
*/
public class FileStorageExample
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private static string VcnDisplayName = "oci_dotnet_sdk_example_vcn";
private static string SubnetDisplayName = "oci_dotnet_sdk_example_subnet";
private static string CidrBlock = "10.0.0.0/16";
private static string ExportPath = "/files";
public static async Task MainFileStorage()
{
logger.Info("Starting example");
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
var compartmentId = Environment.GetEnvironmentVariable("OCI_COMPARTMENT_ID");
var fileSystemDisplayName = Environment.GetEnvironmentVariable("FILE_SYSTEM_DISPLAY_NAME");
var identityClient = new IdentityClient(provider);
var fileStorageClient = new FileStorageClient(provider);
var vcnClient = new VirtualNetworkClient(provider);
Vcn vcn = null;
Subnet subnet = null;
FileSystem fileSystem = null;
MountTarget mountTarget = null;
Export export = null;
Snapshot snapshot = null;
try
{
var availablityDomain = await GetAvailabilityDomain(identityClient, compartmentId);
logger.Info($"availability domain is {availablityDomain.Name}");
// A VCN and subnet is required to create a mount target
vcn = await CreateVcn(vcnClient, compartmentId);
subnet = await CreateSubnet(vcnClient, compartmentId, availablityDomain, vcn);
fileSystem = await CreateFileSystem(fileStorageClient, compartmentId,
fileSystemDisplayName, availablityDomain);
mountTarget = await CreateMountTarget(fileStorageClient, vcnClient,
compartmentId, fileSystemDisplayName + "-mnt", availablityDomain, subnet);
await GetExportSet(fileStorageClient, mountTarget.ExportSetId);
export = await CreateExport(fileStorageClient, fileSystem.Id, mountTarget.ExportSetId);
ListExports(fileStorageClient, compartmentId, fileSystem, mountTarget);
snapshot = await CreateSnapshot(fileStorageClient, fileSystem);
}
catch (Exception e)
{
logger.Error($"Failed to mount file system: {e}");
}
finally
{
logger.Info("cleaning resources....");
if (snapshot != null)
{
await DeleteSnapshot(fileStorageClient, snapshot);
}
if (export != null)
{
await DeleteExport(fileStorageClient, export);
}
if (mountTarget != null)
{
await DeleteMountTarget(fileStorageClient, mountTarget);
}
if (fileSystem != null)
{
await DeleteFileSystem(fileStorageClient, fileSystem);
}
if (subnet != null)
{
await DeleteSubnet(vcnClient, subnet);
}
if (vcn != null)
{
await DeleteVcn(vcnClient, vcn);
}
identityClient.Dispose();
fileStorageClient.Dispose();
vcnClient.Dispose();
logger.Info("End example");
}
}
/**
* Creates a file system and waits for it to become available. We recommend to retry these requests
* so that if you receive a timeout or server error and you won't run into the risk of creating multiple resources.
*
* @param fsClient the service client to use to create the File System
* @param compartmentId the OCID of the compartment where the file system will be created
* @param availabilityDomain the availability domain where the file system will be created
*
* @return the created file system
*/
private static async Task<FileSystem> CreateFileSystem(FileStorageClient fsClient, string compartmentId,
string displayName, AvailabilityDomain availabilityDomain)
{
logger.Info("Creating file system......");
CreateFileSystemDetails createDetails = new CreateFileSystemDetails
{
DisplayName = displayName,
CompartmentId = compartmentId,
AvailabilityDomain = availabilityDomain.Name
};
CreateFileSystemRequest createRequest = new CreateFileSystemRequest
{
CreateFileSystemDetails = createDetails
};
CreateFileSystemResponse createResponse = await fsClient.CreateFileSystem(createRequest, new RetryConfiguration
{
MaxAttempts = 5
});
logger.Info($"Created file system: {createResponse.FileSystem.DisplayName}");
GetFileSystemRequest getRequest = new GetFileSystemRequest
{
FileSystemId = createResponse.FileSystem.Id
};
GetFileSystemResponse getResponse = fsClient.Waiters.ForFileSystem(getRequest, FileSystem.LifecycleStateEnum.Active).Execute();
logger.Info($"Waited for file system to become available: {createResponse.FileSystem.DisplayName}");
return getResponse.FileSystem;
}
/**
* Creates a mount target and waits for it to become available. We recommend to retry these requests
* so that if you receive a timeout or server error and you won't run into the risk of creating multiple resources.
*
* This creates a mount target WITHOUT specifying a hostname. This means that the mount target will only be accessible
* via its private IP address.
*
* @param fsClient the service client to use to create the mount target
* @param vcnClient a client used to communiate with the Virtual Networking service
* @param compartmentId the OCID of the compartment where the file system will be created
* @param displayName the display name of the mount target
* @param availabilityDomain the availability domain where the file system will be created
* @param subnet the subnet where the mount target will reside. If no private IP address is explicitly specified at
* creation time then the mount target will be assigned a free private IP address from the subnet
*
* @return the created mount target
*/
private static async Task<MountTarget> CreateMountTarget(FileStorageClient fsClient, VirtualNetworkClient vcnClient,
string compartmentId, string displayName, AvailabilityDomain availabilityDomain, Subnet subnet)
{
logger.Info("Creating mount target......");
CreateMountTargetDetails createDetails = new CreateMountTargetDetails
{
AvailabilityDomain = availabilityDomain.Name,
SubnetId = subnet.Id,
CompartmentId = compartmentId,
DisplayName = displayName
};
CreateMountTargetRequest createRequest = new CreateMountTargetRequest
{
CreateMountTargetDetails = createDetails
};
var retryConfiguration = new RetryConfiguration
{
MaxAttempts = 5
};
CreateMountTargetResponse createResponse = await fsClient.CreateMountTarget(createRequest, retryConfiguration);
logger.Info($"Created Mount target: {createResponse.MountTarget.DisplayName}");
logger.Info("Waiting for mount target to become available");
GetMountTargetRequest getRequest = new GetMountTargetRequest
{
MountTargetId = createResponse.MountTarget.Id
};
GetMountTargetResponse getResponse = fsClient.Waiters.ForMountTarget(getRequest, MountTarget.LifecycleStateEnum.Active).Execute();
logger.Info($"Mount target state: {getResponse.MountTarget.LifecycleState}");
string mountTargetPrivateIpId = getResponse.MountTarget.PrivateIpIds[0];
GetPrivateIpRequest getPrivateIpRequest = new GetPrivateIpRequest
{
PrivateIpId = mountTargetPrivateIpId
};
GetPrivateIpResponse getPrivateIpResponse = await vcnClient.GetPrivateIp(getPrivateIpRequest);
logger.Info($"Mount target private IP: {getPrivateIpResponse.PrivateIp.IpAddress}");
return getResponse.MountTarget;
}
/**
* Retrieves the details of an export set for a mount target
*
* @param exportSetId the OCID of the export set (obtained from a MountTarget)
*/
private static async Task GetExportSet(FileStorageClient fileStorageClient, string exportSetId)
{
logger.Info("Get export set for mount target");
GetExportSetRequest getExportSetRequest = new GetExportSetRequest
{
ExportSetId = exportSetId
};
GetExportSetResponse getExportSetResponse = await fileStorageClient.GetExportSet(getExportSetRequest);
logger.Info($"Export set for mount target: {getExportSetResponse.ExportSet.DisplayName}");
}
/**
* Creates an export and waits for it to become available. This export enables us to access the file system
* via the mount target. We recommend using a retry token on these requests
* so that if you receive a timeout or server error and need to retry the request you won't run the risk of
* creating multiple resources.
*
* There are rules around export paths and file system associations which you should review here:
* https://docs.cloud.oracle.com/api/#/en/filestorage/20171215/Export/
*
* @param fsClient the service client to use to create the export
* @param fileSystemId the OCID of the file system to associate with the export
* @param exportSetId the OCID of the MountTarget's export set
*
* @return the created export
*/
private static async Task<Export> CreateExport(FileStorageClient fsClient, string fileSystemId, string exportSetId)
{
logger.Info("Creating export.....");
CreateExportDetails createExportDetails = new CreateExportDetails
{
ExportSetId = exportSetId,
FileSystemId = fileSystemId,
Path = ExportPath
};
CreateExportRequest createExportRequest = new CreateExportRequest
{
CreateExportDetails = createExportDetails
};
CreateExportResponse createResponse = await fsClient.CreateExport(createExportRequest,
new RetryConfiguration
{
MaxAttempts = 5
});
logger.Info($"Created Export");
logger.Info($"Waiting for export to become available");
GetExportRequest getRequest = new GetExportRequest
{
ExportId = createResponse.Export.Id
};
GetExportResponse getExportResponse = fsClient.Waiters.ForExport(getRequest, Export.LifecycleStateEnum.Active).Execute();
logger.Info($"Export path state: {getExportResponse.Export.LifecycleState}");
return getExportResponse.Export;
}
/**
* Creates a point in time snapshot of a file system and waits for it to become available. Note that snapshot
* names are immutable and must be unique amongst all non-DELETED snapshots for a file system.
*
* We recommend using a retry token on these requests so that if you receive a timeout or server error
* and need to retry the request you won't run the risk of creating multiple resources.
*
* @param fsClient the service client used to communicate with the File Storage service
* @param fileSystem the file system to create the snapshot of
*/
private static async Task<Snapshot> CreateSnapshot(FileStorageClient fsClient, FileSystem fileSystem)
{
logger.Info("Creating Snapshot...");
CreateSnapshotDetails createSnapshotDetails = new CreateSnapshotDetails
{
FileSystemId = fileSystem.Id,
Name = "example_snapshot"
};
CreateSnapshotRequest createRequest = new CreateSnapshotRequest
{
CreateSnapshotDetails = createSnapshotDetails
};
CreateSnapshotResponse createResponse = await fsClient.CreateSnapshot(createRequest);
logger.Info($"Created snapshot: {createResponse.Snapshot.Name}");
logger.Info($"Waiting for snapshot to become available");
GetSnapshotRequest getRequest = new GetSnapshotRequest
{
SnapshotId = createResponse.Snapshot.Id
};
GetSnapshotResponse getResponse = fsClient.Waiters.ForSnapshot(getRequest, Snapshot.LifecycleStateEnum.Active).Execute();
logger.Info($"Snapshot state: {getResponse.Snapshot.LifecycleState}");
return getResponse.Snapshot;
}
/**
* Demonstrates how to list exports and using various criteria. Note that listing exports is a paginated call, so we should
* get all pages until there is no more opcNextPage token
*
* @param fsClient the service client used to communicate with the File Storage service
* @param compartmentId the OCID of the compartment which owns the resources
* @param fileSystem the file system which we're working with
* @param mountTarget the mount target which we're working with
*/
private static void ListExports(FileStorageClient fsClient, String compartmentId, FileSystem fileSystem, MountTarget mountTarget)
{
// The most basic call is to list exports by comparment ID
ListExportsRequest listExportsRequest = new ListExportsRequest
{
CompartmentId = compartmentId
};
logger.Info("Listing exports by compartment ID");
IterateExports(fsClient, listExportsRequest);
// We can find all exports in a given export set
listExportsRequest.ExportSetId = mountTarget.ExportSetId;
logger.Info("Listing exports by export set");
IterateExports(fsClient, listExportsRequest);
// We can find all exports for a given file system
listExportsRequest.ExportSetId = null;
listExportsRequest.FileSystemId = fileSystem.Id;
logger.Info("Listing exports by file system");
IterateExports(fsClient, listExportsRequest);
}
/**
* Deletes a snapshot and waits for it to be deleted.
*
* @param fsClient the service client used to communicate with the File Storage service
* @param snapshot the snapshot to delete
*/
private static async Task DeleteSnapshot(FileStorageClient fsClient, Snapshot snapshot)
{
logger.Info("Deleting snapshot");
DeleteSnapshotRequest deleteSnapshotRequest = new DeleteSnapshotRequest
{
SnapshotId = snapshot.Id
};
await fsClient.DeleteSnapshot(deleteSnapshotRequest);
GetSnapshotRequest getSnapshotRequest = new GetSnapshotRequest
{
SnapshotId = snapshot.Id
};
fsClient.Waiters.ForSnapshot(getSnapshotRequest, Snapshot.LifecycleStateEnum.Deleted).Execute();
}
/**
* Deletes an export and waits for it to be deleted.
*
* @param fsClient the service client used to communicate with the File Storage service
* @param export the export to delete
*/
private static async Task DeleteExport(FileStorageClient fsClient, Export export)
{
logger.Info("Deleting export");
DeleteExportRequest deleteExportRequest = new DeleteExportRequest
{
ExportId = export.Id
};
await fsClient.DeleteExport(deleteExportRequest);
GetExportRequest getExportRequest = new GetExportRequest
{
ExportId = export.Id
};
fsClient.Waiters.ForExport(getExportRequest, Export.LifecycleStateEnum.Deleted).Execute();
}
/**
* Deletes a mount target and waits for it to be deleted.
*
* @param fsClient the service client used to communicate with the File Storage service
* @param mountTarget the mount target to delete
*/
private static async Task DeleteMountTarget(FileStorageClient fsClient, MountTarget mountTarget)
{
logger.Info("Deleting mount target");
DeleteMountTargetRequest deleteRequest = new DeleteMountTargetRequest
{
MountTargetId = mountTarget.Id
};
await fsClient.DeleteMountTarget(deleteRequest);
WaiterConfiguration waiterConfiguration = new WaiterConfiguration
{
MaxAttempts = 20,
GetNextDelayInSeconds = DelayStrategy.GetExponentialDelayInSeconds
};
GetMountTargetRequest getRequest = new GetMountTargetRequest
{
MountTargetId = mountTarget.Id
};
fsClient.Waiters.ForMountTarget(getRequest, waiterConfiguration, MountTarget.LifecycleStateEnum.Deleted).Execute();
}
/**
* Deletes a file system and waits for it to be deleted.
*
* @param fsClient the service client used to communicate with the File Storage service
* @param fileSystem the file system to delete
*/
private static async Task DeleteFileSystem(FileStorageClient fsClient, FileSystem fileSystem)
{
logger.Info("Deleting file system");
DeleteFileSystemRequest deleteRequest = new DeleteFileSystemRequest
{
FileSystemId = fileSystem.Id
};
await fsClient.DeleteFileSystem(deleteRequest);
WaiterConfiguration waiterConfiguration = new WaiterConfiguration
{
MaxAttempts = 20,
GetNextDelayInSeconds = DelayStrategy.GetExponentialDelayInSeconds
};
GetFileSystemRequest getRequest = new GetFileSystemRequest
{
FileSystemId = fileSystem.Id
};
fsClient.Waiters.ForFileSystem(getRequest, waiterConfiguration, FileSystem.LifecycleStateEnum.Deleted).Execute();
}
/**
* Retrieves a list of availability domains in a compartment.
*
* @param identityClient the client to use to retrieve the availability domains
* @param compartmentId the OCID of the compartment whose availability domains we're listing
*
* @return a availability domain
*/
private static async Task<AvailabilityDomain> GetAvailabilityDomain(IdentityClient identityClient, string compartmentId)
{
ListAvailabilityDomainsRequest listAvailabilityDomainsRequest = new ListAvailabilityDomainsRequest
{
CompartmentId = compartmentId
};
ListAvailabilityDomainsResponse listAvailabilityDomainsResponse = await identityClient.ListAvailabilityDomains(listAvailabilityDomainsRequest);
foreach (AvailabilityDomain ad in listAvailabilityDomainsResponse.Items)
{
if (ad.Name.Equals("Iocq:PHX-AD-2"))
{
return ad;
}
}
return listAvailabilityDomainsResponse.Items[0];
}
/**
* Creates a VCN and waits for it to become available to use.
*
* @param virtualNetworkClient the service client to use to create the VCN
* @param compartmentId the OCID of the compartment where the VCN will be created
*
* @return the created VCN
*/
private static async Task<Vcn> CreateVcn(VirtualNetworkClient virtualNetworkClient, string compartmentId)
{
logger.Info("creating vcn");
CreateVcnDetails createVcnDetails = new CreateVcnDetails
{
CidrBlock = CidrBlock,
CompartmentId = compartmentId,
DisplayName = VcnDisplayName
};
CreateVcnRequest createVcnRequest = new CreateVcnRequest
{
CreateVcnDetails = createVcnDetails
};
CreateVcnResponse createVcnResponse = await virtualNetworkClient.CreateVcn(createVcnRequest);
GetVcnRequest getVcnRequest = new GetVcnRequest
{
VcnId = createVcnResponse.Vcn.Id
};
GetVcnResponse getVcnResponse = virtualNetworkClient.Waiters.ForVcn(getVcnRequest, Vcn.LifecycleStateEnum.Available).Execute();
Vcn vcn = getVcnResponse.Vcn;
logger.Info($"Created vcn: {vcn.Id} and state is {vcn.LifecycleState}");
return vcn;
}
/**
* Creates a subnet in a VCN and waits for the subnet to become available to use.
*
* @param virtualNetworkClient the service client to use to create the subnet
* @param compartmentId the OCID of the compartment which owns the VCN
* @param availabilityDomain the availability domain where the subnet will be created
* @param vcn the VCN which will own the subnet
*
* @return the created subnet
*/
private static async Task<Subnet> CreateSubnet(VirtualNetworkClient virtualNetworkClient, string compartmentId,
AvailabilityDomain availabilityDomain, Vcn vcn)
{
logger.Info("Creating subnet");
CreateSubnetDetails createSubnetDetails = new CreateSubnetDetails
{
AvailabilityDomain = availabilityDomain.Name,
CompartmentId = compartmentId,
DisplayName = SubnetDisplayName,
CidrBlock = CidrBlock,
VcnId = vcn.Id,
RouteTableId = vcn.DefaultRouteTableId
};
CreateSubnetRequest createSubnetRequest = new CreateSubnetRequest { CreateSubnetDetails = createSubnetDetails };
CreateSubnetResponse createSubnetResponse = await virtualNetworkClient.CreateSubnet(createSubnetRequest);
GetSubnetRequest getSubnetRequest = new GetSubnetRequest { SubnetId = createSubnetResponse.Subnet.Id };
GetSubnetResponse getSubnetResponse = virtualNetworkClient.Waiters.ForSubnet(getSubnetRequest, Subnet.LifecycleStateEnum.Available).Execute();
Subnet subnet = getSubnetResponse.Subnet;
logger.Info($"Created Subnet: {subnet.Id}");
return subnet;
}
/**
* Deletes a subnet and waits for it to be deleted.
*
* @param virtualNetworkClient the service client to use to delete the subnet
* @param subnet the subnet to delete
*/
private static async Task DeleteSubnet(VirtualNetworkClient virtualNetworkClient, Subnet subnet)
{
DeleteSubnetRequest deleteSubnetRequest = new DeleteSubnetRequest
{
SubnetId = subnet.Id
};
RetryConfiguration retryConfiguration = new RetryConfiguration
{
MaxAttempts = 5
};
await virtualNetworkClient.DeleteSubnet(deleteSubnetRequest, retryConfiguration);
logger.Info($"Deleted Subnet: {subnet.Id}");
}
/**
* Deletes a VCN and waits for it to be deleted.
*
* @param virtualNetworkClient the service client to use to delete the VCN
* @param vcn the VCN to delete
*/
private static async Task DeleteVcn(VirtualNetworkClient virtualNetworkClient, Vcn vcn)
{
DeleteVcnRequest deleteVcnRequest = new DeleteVcnRequest
{
VcnId = vcn.Id
};
await virtualNetworkClient.DeleteVcn(deleteVcnRequest);
logger.Info($"Deleted Vcn: {vcn.Id}");
}
/**
* Displays the export paths
*
* @param fsClient the service client to use to retrieve the exports
* @param listExportsRequest contains the parameters and filters to get the exports
*/
private static void IterateExports(FileStorageClient fsClient, ListExportsRequest listExportsRequest)
{
IEnumerable<ExportSummary> exportSummaries = fsClient.Paginators.ListExportsRecordEnumerator(listExportsRequest);
foreach (ExportSummary exportSummary in exportSummaries)
{
logger.Info($"Export path: {exportSummary.Path}");
}
}
}
}