// 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.ContainerengineService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Containerengine
{
    public class UpdateNodePoolExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateNodePoolDetails = new Oci.ContainerengineService.Models.UpdateNodePoolDetails
			{
				Name = "EXAMPLE-name-Value",
				KubernetesVersion = "EXAMPLE-kubernetesVersion-Value",
				InitialNodeLabels = new List<Oci.ContainerengineService.Models.KeyValue>
				{
					new Oci.ContainerengineService.Models.KeyValue
					{
						Key = "EXAMPLE-key-Value",
						Value = "EXAMPLE-value-Value"
					}
				},
				QuantityPerSubnet = 954,
				SubnetIds = new List<string>
				{
					"EXAMPLE--Value"
				},
				NodeConfigDetails = new Oci.ContainerengineService.Models.UpdateNodePoolNodeConfigDetails
				{
					Size = 871,
					NsgIds = new List<string>
					{
						"EXAMPLE--Value"
					},
					KmsKeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
					IsPvEncryptionInTransitEnabled = true,
					FreeformTags = new Dictionary<string, string>()
					{
						{
							"EXAMPLE_KEY_ZxDdo", 
							"EXAMPLE_VALUE_It4ZrNy9eUNfk7zJh4oS"
						}
					},
					DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
					{
						{
							"EXAMPLE_KEY_Z7wjx", 
							new Dictionary<string, Object>()
							{
								{
									"EXAMPLE_KEY_mUOP6", 
									"EXAMPLE--Value"
								}
							}
						}
					},
					PlacementConfigs = new List<Oci.ContainerengineService.Models.NodePoolPlacementConfigDetails>
					{
						new Oci.ContainerengineService.Models.NodePoolPlacementConfigDetails
						{
							AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
							SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
							CapacityReservationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value",
							PreemptibleNodeConfig = new Oci.ContainerengineService.Models.PreemptibleNodeConfigDetails
							{
								PreemptionAction = new Oci.ContainerengineService.Models.TerminatePreemptionAction
								{
									IsPreserveBootVolume = true
								}
							},
							FaultDomains = new List<string>
							{
								"EXAMPLE--Value"
							}
						}
					},
					NodePoolPodNetworkOptionDetails = new Oci.ContainerengineService.Models.FlannelOverlayNodePoolPodNetworkOptionDetails
					{
					}
				},
				NodeMetadata = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_Zgvy8", 
						"EXAMPLE_VALUE_unsccH5aSehtvjBLOELr"
					}
				},
				NodeSourceDetails = new Oci.ContainerengineService.Models.NodeSourceViaImageDetails
				{
					ImageId = "ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
					BootVolumeSizeInGBs = 583
				},
				SshPublicKey = "EXAMPLE-sshPublicKey-Value",
				NodeShape = "EXAMPLE-nodeShape-Value",
				NodeShapeConfig = new Oci.ContainerengineService.Models.UpdateNodeShapeConfigDetails
				{
					Ocpus = (float)6936.993,
					MemoryInGBs = (float)6905.115
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_pGgIz", 
						"EXAMPLE_VALUE_Kh6xXowrf5bCoAB7sljB"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_LCare", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_2hm2R", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				NodeEvictionNodePoolSettings = new Oci.ContainerengineService.Models.NodeEvictionNodePoolSettings
				{
					EvictionGraceDuration = "EXAMPLE-evictionGraceDuration-Value",
					IsForceDeleteAfterGraceDuration = false,
					IsForceActionAfterGraceDuration = false
				},
				NodePoolCyclingDetails = new Oci.ContainerengineService.Models.NodePoolCyclingDetails
				{
					MaximumUnavailable = "EXAMPLE-maximumUnavailable-Value",
					MaximumSurge = "EXAMPLE-maximumSurge-Value",
					IsNodeCyclingEnabled = false,
					CycleModes = new List<Oci.ContainerengineService.Models.CycleMode>
					{
						Oci.ContainerengineService.Models.CycleMode.BootVolumeReplace,
						Oci.ContainerengineService.Models.CycleMode.InstanceReplace
					}
				}
			};
			var updateNodePoolRequest = new Oci.ContainerengineService.Requests.UpdateNodePoolRequest
			{
				NodePoolId = "ocid1.test.oc1..<unique_ID>EXAMPLE-nodePoolId-Value",
				UpdateNodePoolDetails = updateNodePoolDetails,
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRequestId = "RCJDXNJAX3LZEJRR5XFK<unique_ID>",
				OverrideEvictionGraceDuration = "EXAMPLE-overrideEvictionGraceDuration-Value",
				IsForceDeletionAfterOverrideGraceDuration = false
			};

            // 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 ContainerEngineClient(provider, new ClientConfiguration()))
				{
					var response = await client.UpdateNodePool(updateNodePoolRequest);
					// Retrieve value from the response.
					var versionValue = response.httpResponseMessage.Version;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateNodePool Failed with {e.Message}");
                throw e;
            }
        }

    }
}

Was this article helpful?