// 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.CoreService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Core
{
public class UpdateInstancePoolExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var updateInstancePoolDetails = new Oci.CoreService.Models.UpdateInstancePoolDetails
{
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_jmh8Q",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_3o3Qp",
"EXAMPLE--Value"
}
}
}
},
DisplayName = "EXAMPLE-displayName-Value",
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_kT145",
"EXAMPLE_VALUE_0fvPn0tx89AgB8rET7cV"
}
},
InstanceConfigurationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceConfigurationId-Value",
PlacementConfigurations = new List<Oci.CoreService.Models.UpdateInstancePoolPlacementConfigurationDetails>
{
new Oci.CoreService.Models.UpdateInstancePoolPlacementConfigurationDetails
{
AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
FaultDomains = new List<string>
{
"EXAMPLE--Value"
},
PrimarySubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-primarySubnetId-Value",
PrimaryVnicSubnets = new Oci.CoreService.Models.InstancePoolPlacementPrimarySubnet
{
IsAssignIpv6Ip = true,
Ipv6AddressIpv6SubnetCidrPairDetails = new List<Oci.CoreService.Models.InstancePoolPlacementIpv6AddressIpv6SubnetCidrDetails>
{
new Oci.CoreService.Models.InstancePoolPlacementIpv6AddressIpv6SubnetCidrDetails
{
Ipv6SubnetCidr = "EXAMPLE-ipv6SubnetCidr-Value"
}
},
SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"
},
SecondaryVnicSubnets = new List<Oci.CoreService.Models.InstancePoolPlacementSecondaryVnicSubnet>
{
new Oci.CoreService.Models.InstancePoolPlacementSecondaryVnicSubnet
{
DisplayName = "EXAMPLE-displayName-Value",
IsAssignIpv6Ip = true,
Ipv6AddressIpv6SubnetCidrPairDetails = new List<Oci.CoreService.Models.InstancePoolPlacementIpv6AddressIpv6SubnetCidrDetails>
{
new Oci.CoreService.Models.InstancePoolPlacementIpv6AddressIpv6SubnetCidrDetails
{
Ipv6SubnetCidr = "EXAMPLE-ipv6SubnetCidr-Value"
}
},
SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"
}
}
}
},
Size = 684,
InstanceDisplayNameFormatter = "EXAMPLE-instanceDisplayNameFormatter-Value",
InstanceHostnameFormatter = "EXAMPLE-instanceHostnameFormatter-Value"
};
var updateInstancePoolRequest = new Oci.CoreService.Requests.UpdateInstancePoolRequest
{
InstancePoolId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instancePoolId-Value",
UpdateInstancePoolDetails = updateInstancePoolDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
IfMatch = "EXAMPLE-ifMatch-Value"
};
// 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 ComputeManagementClient(provider, new ClientConfiguration()))
{
var response = await client.UpdateInstancePool(updateInstancePoolRequest);
// Retrieve value from the response.
var id = response.InstancePool.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"UpdateInstancePool Failed with {e.Message}");
throw e;
}
}
}
}