// 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).

package main

import (
	"context"
	"fmt"

	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/containerengine"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
)

func ExampleCreateNodePool() {
	// 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.
	client, err := containerengine.NewContainerEngineClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := containerengine.CreateNodePoolRequest{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		CreateNodePoolDetails: containerengine.CreateNodePoolDetails{InitialNodeLabels: []containerengine.KeyValue{containerengine.KeyValue{Key: common.String("EXAMPLE-key-Value"),
			Value: common.String("EXAMPLE-value-Value")}},
			Name:          common.String("EXAMPLE-name-Value"),
			SshPublicKey:  common.String("EXAMPLE-sshPublicKey-Value"),
			SubnetIds:     []string{"EXAMPLE--Value"},
			CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			NodeConfigDetails: &containerengine.CreateNodePoolNodeConfigDetails{IsPvEncryptionInTransitEnabled: common.Bool(false),
				KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
				NodePoolPodNetworkOptionDetails: containerengine.OciVcnIpNativeNodePoolPodNetworkOptionDetails{MaxPodsPerNode: common.Int(42),
					PodNsgIds:    []string{"EXAMPLE--Value"},
					PodSubnetIds: []string{"EXAMPLE--Value"}},
				NsgIds: []string{"EXAMPLE--Value"},
				PlacementConfigs: []containerengine.NodePoolPlacementConfigDetails{containerengine.NodePoolPlacementConfigDetails{AvailabilityDomain: common.String("EXAMPLE-availabilityDomain-Value"),
					CapacityReservationId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value"),
					FaultDomains:          []string{"EXAMPLE--Value"},
					PreemptibleNodeConfig: &containerengine.PreemptibleNodeConfigDetails{PreemptionAction: containerengine.TerminatePreemptionAction{IsPreserveBootVolume: common.Bool(false)}},
					SubnetId:              common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value")}},
				Size:         common.Int(363),
				DefinedTags:  map[string]map[string]interface{}{"EXAMPLE_KEY_jj8ZU": map[string]interface{}{"EXAMPLE_KEY_hS2vC": "EXAMPLE--Value"}},
				FreeformTags: map[string]string{"EXAMPLE_KEY_pdwLD": "EXAMPLE_VALUE_tsnqvlPNd9DgAllkiPoD"}},
			NodeImageName: common.String("EXAMPLE-nodeImageName-Value"),
			NodePoolCyclingDetails: &containerengine.NodePoolCyclingDetails{MaximumUnavailable: common.String("EXAMPLE-maximumUnavailable-Value"),
				IsNodeCyclingEnabled: common.Bool(false),
				MaximumSurge:         common.String("EXAMPLE-maximumSurge-Value")},
			NodeShape: common.String("EXAMPLE-nodeShape-Value"),
			NodeShapeConfig: &containerengine.CreateNodeShapeConfigDetails{MemoryInGBs: common.Float32(5594.3667),
				Ocpus: common.Float32(312.24786)},
			QuantityPerSubnet: common.Int(260),
			ClusterId:         common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clusterId-Value"),
			DefinedTags:       map[string]map[string]interface{}{"EXAMPLE_KEY_6bVvM": map[string]interface{}{"EXAMPLE_KEY_8x05Y": "EXAMPLE--Value"}},
			NodeEvictionNodePoolSettings: &containerengine.NodeEvictionNodePoolSettings{EvictionGraceDuration: common.String("EXAMPLE-evictionGraceDuration-Value"),
				IsForceDeleteAfterGraceDuration: common.Bool(false)},
			NodeMetadata:      map[string]string{"EXAMPLE_KEY_SpHjf": "EXAMPLE_VALUE_MeLAlWV3LqOJ0FcSE5hf"},
			FreeformTags:      map[string]string{"EXAMPLE_KEY_YjWm7": "EXAMPLE_VALUE_yVMgkeEqbs3IxXosaMAO"},
			KubernetesVersion: common.String("EXAMPLE-kubernetesVersion-Value"),
			NodeSourceDetails: containerengine.NodeSourceViaImageDetails{BootVolumeSizeInGBs: common.Int64(968),
				ImageId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value")}},
		OpcRequestId: common.String("NMT1HMZ2YPO3NV8OWJ7J<unique_ID>")}

	// Send the request using the service client
	resp, err := client.CreateNodePool(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}