// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.DataccService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Datacc
{
public class UpdateInfrastructureExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var updateInfrastructureDetails = new Oci.DataccService.Models.UpdateInfrastructureDetails
{
DisplayName = "EXAMPLE-displayName-Value",
Description = "EXAMPLE-description-Value",
SystemModel = Oci.DataccService.Models.SystemModelEnum.X11Ha768,
Shape = Oci.DataccService.Models.ShapeEnum.TwelveSsds,
CloudControlPlaneServer1 = "EXAMPLE-cloudControlPlaneServer1-Value",
CloudControlPlaneServer2 = "EXAMPLE-cloudControlPlaneServer2-Value",
Netmask = "EXAMPLE-netmask-Value",
Gateway = "EXAMPLE-gateway-Value",
AdminNetworkcidr = "EXAMPLE-adminNetworkcidr-Value",
DataDiskPercentage = 47,
Contacts = new List<Oci.DataccService.Models.InfrastructureContact>
{
new Oci.DataccService.Models.InfrastructureContact
{
Name = "EXAMPLE-name-Value",
PhoneNumber = "EXAMPLE-phoneNumber-Value",
Email = "EXAMPLE-email-Value",
IsPrimary = false,
IsContactMosValidated = false
}
},
DnsServers = new List<string>
{
"EXAMPLE--Value"
},
NtpServers = new List<string>
{
"EXAMPLE--Value"
},
ClientNetworkBondingMode = Oci.DataccService.Models.NetworkBondingMode.Lacp,
BackupNetworkBondingMode = Oci.DataccService.Models.NetworkBondingMode.ActiveBackup,
CpsNetworkBondingMode = Oci.DataccService.Models.NetworkBondingMode.ActiveBackup,
ClientNetworkBondingInterface = Oci.DataccService.Models.NetworkBondingInterfaceEnum.Btbond4,
BackupNetworkBondingInterface = Oci.DataccService.Models.NetworkBondingInterfaceEnum.Btbond6,
CpsNetworkBondingInterface = Oci.DataccService.Models.NetworkBondingInterfaceEnum.Btbond3,
AcfsFileSystemStorageInGbs = 2947.7126,
CorporateProxy = "EXAMPLE-corporateProxy-Value",
VlanId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vlanId-Value",
MaintenanceWindow = new Oci.DataccService.Models.MaintenanceWindow
{
Preference = Oci.DataccService.Models.MaintenancePreference.CustomPreference,
PatchingMode = Oci.DataccService.Models.BasePatchingMode.Rolling,
IsCustomActionTimeoutEnabled = true,
CustomActionTimeoutInMins = 776,
IsMonthlyPatchingEnabled = false,
Months = new List<Oci.DataccService.Models.MaintenanceWindow.MonthsEnum>
{
Oci.DataccService.Models.MaintenanceWindow.MonthsEnum.November
},
WeeksOfMonth = new List<Int32>
{
1
},
DaysOfWeek = new List<Oci.DataccService.Models.MaintenanceWindow.DaysOfWeekEnum>
{
Oci.DataccService.Models.MaintenanceWindow.DaysOfWeekEnum.Thursday
},
HoursOfDay = new List<Int32>
{
17
},
LeadTimeInWeeks = 3
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_QvUZH",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_ixEfb",
"EXAMPLE--Value"
}
}
}
},
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_q1xiI",
"EXAMPLE_VALUE_BlAyeAgaIzacjvrIwu40"
}
}
};
var updateInfrastructureRequest = new Oci.DataccService.Requests.UpdateInfrastructureRequest
{
UpdateInfrastructureDetails = updateInfrastructureDetails,
InfrastructureId = "ocid1.test.oc1..<unique_ID>EXAMPLE-infrastructureId-Value",
IfMatch = "EXAMPLE-ifMatch-Value",
OpcRequestId = "PRDQ1XTIJX1BPZTGHN4B<unique_ID>"
};
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new BaseinfraClient(provider, new ClientConfiguration()))
{
var response = await client.UpdateInfrastructure(updateInfrastructureRequest);
// Retrieve value from the response.
var id = response.Infrastructure.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"UpdateInfrastructure Failed with {e.Message}");
throw e;
}
}
}
}